2

I want to know how you would make a script add 1 number each second to a value (Making a spinning loading Gui)

1 Answers1

1

Hoping this does the trick for you:

startTime = os.time()
count = 1
while 1 do
        if os.difftime(os.time(), startTime) == 1 then
                print (count)
                count = count + 1
                startTime = os.time()
        end
end

Of course in your case, you might not print the value of the counter but instead pass it as a value to your GUI spinner to indicate loading time.

Also, in the 'while' condition, you may want to replace the test condition to something definitive, instead of the 1 (that will result infinitely). Say you're counting till 100, then the test condition would terminate the loop once the counter reaches 100.