this has been closed
Can you restate what you mean by:
I don’t think you should put the for i,v in pairs in the while loop cause it gonna keep firing the LoopThrough function.
I agree with @FlashFlame_Roblox. You shouldn’t use for i,v in ipairs(). I can see that there’s a delay on one player. After the delay, it will go on to the other. So and so on. The intermission wouldn’t be glitched. Here’s what was needed for your script:
local function ShowIntermission(TimeGui, Secs, Format)
local IntermissionFormat = string.format(Format, Secs)
TimeGui.Frame.TextLabel.Text = IntermissionFormat
end
while true do
local Restart = game.ReplicatedStorage.Restart
local Teleport = game.ReplicatedStorage.Teleport
local GameEnded = game.ReplicatedStorage.GameEnded
local seconds = 10
repeat
for i,v in pairs(game.Players:GetPlayers()) do
local TimeGui = v.PlayerGui:FindFirstChild('TimeGui')
if TimeGui then
ShowIntermission(TimeGui, seconds, "Intermission: %s")
end
end
seconds = seconds - 1
wait(1)
until seconds == 0
Teleport:Fire()
seconds = 20
repeat
for i,v in pairs(game.Players:GetPlayers()) do
local TimeGui = v.PlayerGui:FindFirstChild('TimeGui')
if TimeGui then
ShowIntermission(TimeGui, seconds, "Round: %s")
end
end
seconds = seconds - 1
wait(1)
until seconds == 0
Restart:Fire()
GameEnded:Fire()
wait()
end
I’ve added additional changes to the code. This shouldn’t bother if a new player or player joins. Hopefully, this is what you’re looking for.
the text gets stuck at “Intermission: 10”
I see it. I added an additional change, whereas seconds lose one second until it’s 0 seconds.
It still glitches out when more then 1 person plays it.
like, it shows the intermission and round gui 2 times