How come it's bugging when I have 2 or more players?

When I test the game by myself, it works perfectly fine but when I play with other players the whole intermission starts getting buggy. If someone knows why plz tell me.

https://i.gyazo.com/afbe5b185de731071b47e9c64e403cdc.mp4 – with players
https://i.gyazo.com/e5a1fc7c81a5df1aa22615215ed5b1e6.mp4 – myself

– Code

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Map = ReplicatedStorage:WaitForChild("Map")
local Status = ReplicatedStorage:WaitForChild("Status")
local AlivePlayers = 0

local Died
game.Players.PlayerAdded:Connect(function(player)

	Died = Instance.new("BoolValue")
	Died.Value = false
	Died.Parent = player
	Died.Name = "Died"

	player.CharacterAdded:Connect(function(character)
		print("character added")
		character.Humanoid.Died:Connect(function()
			for _,Plr in pairs(game.Players:GetPlayers()) do
				if player.Name == Plr.Name then
					Died.Value = true
					AlivePlayers = AlivePlayers - 1
					print(Plr)
				end
			end
		end)
	end)

	if #game.Players:GetPlayers() >= 1 then Intermission() else Status.Value = "Wait for 2 or more players" end


end)

function Intermission()
	while wait() do
	local Playercount = #game.Players:GetPlayers()
 	AlivePlayers = Playercount
	
	local Time = 20

	repeat
		Time = Time - 1
		wait(1)
		Status.Value = "Intermission in "..Time
	until Time == 1

	wait(1)
	Status.Value = "Starting Game!!"

	Map:Clone().Parent = workspace

	wait(3)

	for i, Plr in pairs(game.Players:GetPlayers()) do
		Plr.Died.Value = false
		Plr.Character.HumanoidRootPart.Position = workspace.Map.Position + Vector3.new(0,50,0)
	end
	
	local IsWined = false
	local Winer = 'Nil'
	local Playerleft = 0
		
		
	while IsWined == false do
			wait(1)
			Status.Value = "Waiting until one man left"
			wait(3)
		for i, Plr in pairs(game.Players:GetPlayers()) do
			if Plr.Died.Value == false and AlivePlayers == 1 then
				Winer = Plr.Name
				Status.Value = Winer.." has won the game!!"
				wait(6)
				IsWined = true
			end
		end
	end
	
	Status.Value = "Restarting game"
	
	for i, Plr in pairs(game.Players:GetPlayers()) do
		Plr.Character.HumanoidRootPart.Position = workspace.Lobby.Floor.Position + Vector3.new(0,50,0)
		Plr.Died.Value = false
	end
	

	end
end

I think the issue is because you call the countdown function every time a player joins so it is counting down multiple times.
if #game.Players:GetPlayers() >= 1 then Intermission() else Status.Value = "Wait for 2 or more players" end

I recommend making a different script that takes care of the intermissions and games. It will start counting once the player count is higher than 1. Goodluck! :+1:

Ok, but do you have any idea of how to approach this solution? Cause I have no clue.

You could also just add a variable to tell if the intermission is started:

local intermissionStarted = false
-- add a variable to check intermission
game.Players.PlayerAdded:Connect(function(player)
	
	if #game.Players:GetPlayers() >= 1 and not intermissionStarted then -- check for intermission
		Intermission()
		intermissionStarted = true-- set the intermission so it doesn't repeat the function
	else 
		Status.Value = "Wait for 2 or more players" 
	end
	
end)

And then set it to false after a game is finished:

for i, Plr in pairs(game.Players:GetPlayers()) do
			if Plr.Died.Value == false and AlivePlayers == 1 then
				Winer = Plr.Name
				Status.Value = Winer.." has won the game!!"
				wait(6)
				IsWined = true
                intermissionStarted = false-- set to false so it starts intermission after the game is finished
			end
		end