so im trying to make a round system where the players is teleported to the map when the match starts and teleported to the lobby again when the mtch ends... unfortunately, the only problem of my script is that, when the countdown comes to 0 (zero) the player is not teleported
local intermission = 10
local roundLength = 15
local InRound = game.ReplicatedStorage.InRound
local status = game.ReplicatedStorage.Status
InRound.Changed:Connect(function()
if InRound.Value == true then
for i, plr in pairs(game.Players:GetChildren()) do
local char = plr.Character
local humanRoot = char:WaitforChild("HumanoidRootPart")
humanRoot.CFrame = game.Workspace.MapSpawn.CFrame
end
else
for i, plr in pairs (game.Players:GetChildren()) do
local char = plr.Character
local humanRoot = char:WaitForChild("HumanoidRootPart")
humanRoot.CFrame = game.Workspace.lobbyspawn.CFrame
end
end
end)
local function round()
while true do
InRound.Value = false
for i = intermission, 0, -1 do
status.Value = "Game Will Start in "..i.." seconds"
wait(1)
end
InRound.Value = true
for i = roundLength, 0, -1 do
status.Value = "Game Will End in "..i.." seconds"
wait(1)
end
end
end
spawn(round)
** You are now Level 3! **