while GameStart == true do
TimerMessage = Instance.new("Hint", game.Workspace)
TimerMessage.Text = "This game will end in " ..TimerValue.. " seconds"
wait(1)
TimerValue = TimerValue - 1
TimerMessage:remove()
if TimerValue == 0 then
GameStart = false
IsArtist = false
TimerValue = 120
end
end
The problem you were having is you had it underneath the While loop. Loops will continuously run, until told to stop, and the thing stopping your loop was GameStart, and the only time it was changed is underneath the loop.
I put that part of code at the bottom of the loop, so every time it loops it checks to see if TimerValue is == 0, and if it is then it will change GameStart to false, thus stopping the loop, and continuing down the script.
I would suggest for this kind of script to use a For loop, as it would be simpler to countdown, for example something like:
for i = 10, 0, -1 do
print(i)
end
Would print: 10, 9 , 8, 7, 6, 5, 4, 3, 2, 1, 0, in the Output and it is a lot more effective.
For more on For loops or just any loop in general, check out the Wiki.
If the script still doesn't work, please Edit your question with the script, and any errors in the output.
If it does work, then please be sure to +1 and accept the answer.
2 comments
Thanks NinjoOnline, its works
No problem :)