I made a script that makes it so you can walk for 30 seconds when a dev product is purchased. (It just sets the walk speed to 16 then wait(30) then sets it back to 0) I want the timer to be displayed overhead of the player so they can see their remaining time. How can I do this?
COMMUNITY QUESTION
How to connect a wait timer to a overhead gui?
1 answer
Use a for loop from 30 to 0 with a step of -1, on each iteration wait one second. Use the variable (i) as it will tell you which iteration the timer is currently on.
local label = someTextLabel
-- ...
-- then when the player buys the product,
humanoid.WalkSpeed = 16 -- set the walk speed
for i = 30,0,-1 do -- i will be equal to a number between 30 and 0 inclusively
label.Text = i
task.wait(1)
end
humanoid.WalkSpeed = 0 -- remove the walk speed
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
Thank you! Let me try that out
I'm getting Unknown global ' humanoid ' error for both humanoids in line 6 and 10
Yeah you have to define the humanoid yourself through the player's character.
How can I do that?
Use the player's character property.