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 this gui timer script work?

In roblox studio it works all the way down to 0 but when I test it on a regular game it goes down a couple of seconds then it stops. Here's the code.

while wait(3) do
for i=300, 0, -1 do
game.StarterGui.SFTimer.TextLabel.Text = ("Time left: "..i)
wait(1)
end
end

1 answer

Why are you editing StarterGui? In order to change each player's gui you have to edit the one in each PlayerGui. Something along the lines of:

while wait(3) do
	for i = 300,0,-1 do
		for _,v in pairs(game.Players:GetPlayers()) do
			if v:FindFirstChild("PlayerGui") then--just a precaution
				v.PlayerGui.SFTimer.TextLabel.Text = "Time left: "..i
				wait(1)
			end
		end
	end
end

5 comments

0

Another solution would be to control a single IntValue with a server Script then use a LocalScript in the guis to change their text.

0

The script works but it waits 3 seconds then it goes down

0

Because you have the while wait(3) do

0

I changed it to while wait(1) do

0

Thanks for the help i appreciate it

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