So in this script, what I'm trying to do is have all the players in the game go on the team "Players" as Intermission ends.
local roundLength = 180
local intermissionLength = 5
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local teamPlaying = Teams.Playing
local teamSpectators = Teams.Spectating
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameAreaSpawn
local Part = workspace.LobbyFloor
InRound.Changed:Connect(function()
wait(1)
if InRound.Value == true then
Part.CanCollide = false
wait(2)
Part.CanCollide = true
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
end
end
end)
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: ".. i .." seconds left!"
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1)
Status.Value = "Game: ".. i .." seconds left!"
local function onPlayerDied(player, character)
-- When someone dies, put them on the spectator team
player.Team = teamSpectators
end
end
end
end
spawn (roundTimer)
I attempted to try and put code on line 19 stating player.Team = teamPlaying but that did not work. To make the script work, the script above needs to be placed in ServerScriptService and a script called LocalScript that's in Starter Gui under a ScreenGui named Timer and beside text that's named TimerDisplay. Also need an int value called InRound in ReplicatedStorage and a String value named Status. The following is localscript
local Status = game.ReplicatedStorage.Status
local TimerDisplay = script.Parent.TimerDisplay
Status.Changed:Connect(function()
TimerDisplay.Text = Status.Value
end)
