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

Why won't timer work with string value thing yes?

Asked by 3 years ago
local Time = "N/A"

while true do

    if script.Parent.Value == 0 then

        script.Parent.ClickDetector.MaxActivationDistance = 32

    else

        Time = script.Parent.Value - 1
        wait(1)
        script.Parent.Value = Time
        script.Parent.SurfaceGui.TextLabel.Text = Time

    end

end
0
Please post a description. See https://idownvotedbecau.se/UnclearQuestion User#30567 0 — 3y
0
@cookie_more You don't need to know the script's parent in order for you to help. zane21225 243 — 3y

1 answer

Log in to vote
0
Answered by
zane21225 243 Moderation Voter
3 years ago

I see some things that I am able to fix up!

Here's the fixed code, let me know if it works!

local Time = 'N/A'
local timestart = 30 --how many seconds it counts down from

for i = timestart, 1, -1 do
wait(1)
Time = i
script.Parent.Value = Time
script.Parent.SurfaceGui.TextLabel.Text = Time
end

script.Parent.ClickDetector.MaxActivationDistance = 32

Also, if you're using a Server Script then the TextLabel's text will probably not update. Try handling everything related to GUIs via LocalScripts.

0
You are correct for everything, except GUIs will update if changed from server. User#30567 0 — 3y
0
^ My bad! I've just had experience with them not working well with ServerScripts. Will note! zane21225 243 — 3y
Ad

Answer this question