Hey guys I need help fixing this script I am trying to make it loop but it keeps stoping after the time is up can you please help me fix this:
wait(0.5)
There are a couple of issues with your code, I’ll just state the obvious:
You don’t need to be calling game.Players.LocalPlayer.PlayerGui every time you want to get the Player’s GUI, instead you could just define a variable called: local PlayerGui = Player:WaitForChild("PlayerGui")
You concatenated with 3 dots instead of 2
Spacing, it hurts
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local TimeUntilStart = 30
PlayerGui.Timer.Enabled = true
for count = 1, 30 do
TimeUntilStart = TimeUntilStart - 1
PlayerGui.Timer.Frame.TextLabel.Text = TimeUntilStart.." Seconds Until Next Round!"
wait(1)
end
local Minute = 4
local Seconds = 59
while true do
Seconds = Seconds - 1
if Seconds == 0 and Minute == 0 then
break
end
if Seconds == 0 then
Seconds = 59
Minute = Minute - 1
end
PlayerGui.Timer.Frame.TextLabel.Text = Minute..":"..Seconds.. " Until Round Ends!"
if Seconds < 10 then
PlayerGui.Timer.Frame.TextLabel.Text = Minute..":"..0..Seconds.." ..Until Round Ends!"
end
wait(1)
end
PlayerGui.Timer.Enabled = false
Minute = 0
Seconds = 5
local Copy = script:Clone()
Copy.Name = "TimerScript"
Copy.Parent = game.ReplicatedFirst
Copy.Disabled = true
wait()
script:Destroy()