I'm making an intermission for my round-based game. So, like any intermission, I have a timer GUI. It's supposed to tick down for 15 seconds and when it gets to 0, it will teleport all players to the map.
The problem is, the TextLabel which I set the text to display the intermission timer's value will automatically stop ticking at 14. Can someone help? Here's my code:
repstorage = game.ReplicatedStorage timer = game.StarterGui.RoundTimer.TimerText local intermission = Instance.new("IntValue") intermission.Name = "Intermission" intermission.Value = 15 intermission.Parent = game.ReplicatedStorage function countdown() repeat intermission.Value = intermission.Value - 1 timer.Text = intermission.Value wait(1) until intermission.Value == 0 if intermission.Value == 0 then intermission.Value = intermission.Value + 15 end end repstorage.ChildAdded:Connect(countdown)
go easy on me
You have to access the player's playerGui, not the starterGui!
Try this:
repstorage = game.ReplicatedStorage local intermission = Instance.new("IntValue") intermission.Name = "Intermission" intermission.Value = 15 intermission.Parent = game.ReplicatedStorage function updateGui() for x,y in pairs(players) do -- goes thru all the players (x = key, y = the player) y.PlayerGui.RoundTimer.TimerText.Text = intermisson.Value -- Updates the gui end end function countdown() players = game.Players:GetChildren() -- I added this table of all the players repeat intermission.Value = intermission.Value - 1 updateGui() wait(1) until intermission.Value == 0 if intermission.Value == 0 then intermission.Value = intermission.Value + 15 end end repstorage.ChildAdded:Connect(countdown)
Plz accept! (If it helped)
Maybe try this, I have an intermission script and it works fine.
local timer = game.StarterGui.RoundTimer.TimerText function intermission() for i = 15,0,-1 do timer.Text = ""..i.."" wait(1) end) while true do intermission() wait(1) end
This should work. But it doesn't do it every time a player joins. Good Luck!