this works in the studio test but not in the game

local team = game.Teams.Left
local playerspawn = game.Workspace:WaitForChild("PlayerSpawn")
local killerspawn = game.Workspace:WaitForChild("KillerSpawn")



while true do
	local killer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
    
	script.Parent.Text = "Intermission: "
	
	for i = 10,1,-1 do
		wait(1)
		script.Parent.Text = "Intermission: "..i
			if script.Parent.Text == "Intermission: 1" then
				wait(1)
				script.Parent.Text = "Game is Starting"
				wait(5)
			end
			
		
		
	end
	



for _, player in pairs(game:GetService("Players"):GetPlayers()) do
    player.Team = team
end	
killer.TeamColor = BrickColor.new("Maroon")
wait(1)

killer.Character.Torso.CFrame = CFrame.new(killerspawn.Position + Vector3.new(0, 3, 0))

for i = 20,1,-1 do
		wait(1)
		script.Parent.Text = "Game in progress: "..i
		if script.Parent.Text == "Game in progress: 1" then
			wait(1)
			script.Parent.Text = "Game has ended!" 
			wait(2)
		end
		
		
end
killer.Character.Head:Destroy()

end