Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to connect a wait timer to a overhead gui?

Asked by 1 year ago

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?

1 answer

Log in to vote
0
Answered by
7z99 203 Moderation Voter
1 year ago
Edited 1 year ago

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
0
Thank you! Let me try that out Sxribbly 16 — 1y
0
I'm getting Unknown global ' humanoid ' error for both humanoids in line 6 and 10 Sxribbly 16 — 1y
0
Yeah you have to define the humanoid yourself through the player's character. 7z99 203 — 1y
0
How can I do that? Sxribbly 16 — 1y
0
Use the player's character property. 7z99 203 — 1y
Ad

Answer this question