Help with making an Intermission repeat

Hey! I need help with making this intermission script that I made to repeat, this is my first time doing an intermission script so it might get messy. Thanks! No I’m not asking for entire scripts, I just need like a few lines of code to help in repeating it.

local status = game.ReplicatedStorage.Status
status.Value = 30
local player = game.Players:GetPlayers()
local roundTimer = game.ReplicatedStorage.roundTimer
if  #player >= 1 then
	while wait() do
		script.Parent.Text = status.Value
		status.Value -= 1
		wait(1)
		script.Parent.Text = status.Value
		if script.Parent.Text == "0" then
			break
		end
	end
	if script.Parent.Text == "0" then
		print("Done")
	end
else
	script.Parent.Text = "Waiting for players"
end

if script.Parent.Text == "0" then
	for i, players in pairs(player)do
		local int = Instance.new("IntValue")
		int.Parent = players
		local char = players.Character
		print("Hello")		
		char.HumanoidRootPart.CFrame = game.Workspace.map.SpawnArea.CFrame
	end
	roundTimer.Value = 300
	script.Parent.Text = "Game ends in:"..roundTimer.Value
	wait(1)
	roundTimer.Value -= 1
	script.Parent.Text = "Game ends in:"..roundTimer.Value
end

What exactly is the reason you can’t just chuck the entirety of the code into a infinitely repeating while loop?

while true do

end

Are there any complications that prevent you from doing this? Sorry if I am missing something.

2 Likes