Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

Please post a description. See https://idownvotedbecau.se/UnclearQuestion

0

@cookie_more You don't need to know the script's parent in order for you to help.

1 answer

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.

2 comments

0

You are correct for everything, except GUIs will update if changed from server.

0

^ My bad! I've just had experience with them not working well with ServerScripts. Will note!

This discussion is preserved as it was. New answers, comments, and votes are closed.