Round Timer

ServerScriptService

local lobbyLocation = game.Workspace.Lobby.Position + Vector3.new(0,3,0)

local gameLocation = game.Workspace.Main.Position + Vector3.new(0,3,0)


local ReplicatedStorage = game:GetService('ReplicatedStorage')

local timeEvent = ReplicatedStorage:WaitForChild('TimeEvent')


local function playGame()

local timeAmount = 20

local timerText = 'Remaining Time: '

while timeAmount > 0 do

timeEvent:FireAllClients(timeAmount, timerText)

wait(1)

timeAmount -= 1

end

end


local function playIntermission()

local intermission = 10

local timerText = 'Intermission: '

while intermission > 0 do

timeEvent:FireAllClients(intermission, timerText)

wait(1)

intermission -= 1

end

end


local function resetPlayers()

for _, plr in pairs(game.Players:GetChildren()) do

plr.Character.HumanoidRootPart.CFrame = CFrame.new(lobbyLocation)

end

end


local function teleportPlayers()

for _, plr in pairs(game.Players:GetChildren()) do

plr.Character.HumanoidRootPart.CFrame = CFrame.new(gameLocation)

end

end


while true do

resetPlayers()

playIntermission()

teleportPlayers()

playGame()

end


LocalScript

local label = script.Parent


local ReplicatedStorage = game:GetService('ReplicatedStorage')

local timeEvent = ReplicatedStorage:WaitForChild('TimeEvent')


timeEvent.OnClientEvent:Connect(function(timeAmount, timerText)

label.Text = timerText..timeAmount

end)