So I am trying to make a rounds system that has an intermission where all players are sent to the lobby and a round when all players are sent to the map except those that join after the round started. I have two scripts, one to handle the rounds and one to handle player joining
RoundHandler
local players = game.Players
local active = true
local RS = game:GetService("ReplicatedStorage")
local roundTime = RS:WaitForChild("RoundTime")
-- Time
local intermissionTime = 10
local gameTime = 15
while active do
for i = intermissionTime, 1,-1 do
roundTime.Value = "Intermission ends in "..i.." seconds"
wait(1)
end
RS.RoundActive.Value = true
for i = gameTime, 1,-1 do
roundTime.Value = "Round ends in "..i.." seconds"
wait(1)
end
RS.RoundActive.Value = false
end
PlayerAdded Script
local players = game.Players
local RS = game:GetService("ReplicatedStorage")
local lobby = game.Workspace.Lobby
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Wait()
if RS:WaitForChild("RoundActive").Value == true then
plr.Character:SetPrimaryPartCFrame(lobby.CFrame + Vector3.new(0, 2, 0))
elseif RS:WaitForChild("RoundActive").Value == false then
plr.Character:SetPrimaryPartCFrame(lobby.CFrame + Vector3.new(0, 2, 0))
end
end)