Remember, computers are dumb and they only do exactly what we tell them.
On line 3, you set the Hint's text to "Time Left : T -120".
This is the only place you ever tell the computer to change the text of the Hint.
In the while loop, you change the variable n
, but it is simply an integer and does not actually do anything.
On line 10 you perform a check, but that line will never run because you made an eternal loop on line 05. Even if it did run, it would only run once, and would only check if n
equals 11 at the time it ran.
You do have all the right code, though. You just need to configure it correctly. I'm going to change some of the variable names to make more sense for what they're used for.
01 | local hint = Instance.new( "Hint" , game.Workspace) |
05 | hint.Text = "Time Left : T -" ..counter |
Although admittedly a for
loop is usually the preferred way to do this, I decided to use the code you already wrote.