while lime > 1 do lime = 60 lime = lime -1 game.StarterGui.main.counter.Text = lime end
Your script has a few issues:
lime
to be 60 on each iteration, effectively creating an infinite loop.StarterGui
, rather than PlayerGui
.When creating a countdown, you generally want to use a numeric for. I'll let the wiki explain what that is. You can easily change your script to use a numeric for:
for lime = 60, 1, -1 do game.StarterGui.main.counter.Text = lime end
That handles the first problem, but there are still two problems with this. The first one is a really common mistake. You used StarterGui to try to change the contents of players' GUIs. Check out the blog post1 for an explanation of that.
The second issue is that there's no delay-- the loop will almost instantly finish because you don't wait
. This can be easily remedied:
for lime = 60, 1, -1 do game.StarterGui.main.counter.Text = lime wait(1) end
This doesn't fix the StarterGui issue, though. Depending on whether you have Filtering enabled or not, you can go about fixing this differently. Personally, I'd prefer using a RemoteEvent
either way. The blog post1 shows you a different way to go about it, if you prefer that method. I'm going to let you decide how to go about doing that.
Hope this helped.
P.S.: In the future, please explain your problem in full (i.e., explain exactly what happens) using your post, not only the title.