recently i wanted to make a sword fighting game with rounds as a starter, so i watched a tutorial on how to make the rounds system, but there is a problem
local intermission = 10
local RoundLength = 15
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local PlayingTeam = game.Teams.Playing
local LobbyTeam = game.Teams.Lobby
InRound.Changed:Connect(function()
if InRound.Value == true then
for i, plr in pairs(game.Players:GetPlayers()) do --start round
local char = plr.Character
local HumanRoot = char:WaitForChild("HumanoidRootPart")
HumanRoot:PivotTo(game.Workspace.MapSpawn.CFrame)
plr.Team = PlayingTeam
char:WaitForChild("Humanoid").Died:Connect(function()
plr.Team = LobbyTeam
end)
end
else
for i, plr in pairs(game.Players:GetPlayers()) do --end round
local char = plr.Character
local HumanRoot = char:WaitForChild("HumanoidRootPart")
HumanRoot:PivotTo(game.Workspace.Lobby.LobbySpawn.CFrame)
plr.Team = LobbyTeam
end
end
end)
local function round()
while true do
InRound.Value = false
for i = intermission, 0, -1 do
Status.Value = "Game starts in" ..i.. "Seconds"
task.wait(1)
end
InRound.Value = true
for i = RoundLength, 0, -1 do
Status.Value = "Game ends in" ..i.. "Seconds"
local Playing = {}
for i, plr in pairs(game.Players:GetPlayers()) do
if plr.Team == "Playing" then
table.insert(Playing, plr.Name)
end
end
if #Playing == 0 then
Status.Value = "Everyone Has Died!"
task.wait(3)
break
end
if #Playing == 1 then
Status.Value = Playing[1].."Has Won!"
task.wait(3)
break
end
task.wait(1)
end
end
end
task.spawn(round)
i tried multiplayer too, it immediatly ends the round like that