I need help to make it so when no one is in a table it will stop the “Ingame” timer and begin the “Preround” timer. Sorry for the bad formatting.
–Game Stats
local roundLength = 60 --Change this value to edit the ingame length
local preroundLength = 10 --Change this value to edit the preround length
local InRound = game.ReplicatedStorage:WaitForChild(“InRound”)
local LobbySpawn = game.Workspace.LobbySpawn
local GameSpawn = game.Workspace.GameSpawn
local Status = game.ReplicatedStorage:WaitForChild(“Status”)
local PLRwaitingList = {}
local PLRingame = {}
InRound.Changed:Connect(function()
if InRound.Value == true then
local UpperTilesClone = game.ReplicatedStorage.UpperTiles:Clone()
UpperTilesClone.Parent = game.Workspace
UpperTilesClone.Name = “UpperTiles”
local BottomTilesClone = game.ReplicatedStorage.BottomTiles:Clone()
BottomTilesClone.Parent = game.Workspace
BottomTilesClone.Name = "BottomTiles"
game.Workspace.GameSpawn.Bell.Playing = true
game.Workspace.GameSpawn.ThemeMusic.Playing = true
wait(1)
PLRingame = PLRwaitingList
for _, Player in pairs(PLRingame) do
local Character = Player.Character
if Character then
local HumanoidRootPart = Character.HumanoidRootPart
if HumanoidRootPart then
HumanoidRootPart.CFrame = GameSpawn.CFrame
end
end
end
else
for _, player in pairs(PLRingame) do
local Character = player.Character
if Character then
local HumanoidRootPart = Character.HumanoidRootPart
if HumanoidRootPart then
HumanoidRootPart.CFrame = LobbySpawn.CFrame
PLRingame = {}
game.Workspace.UpperTiles:Destroy()
game.Workspace.BottomTiles:Destroy()
end
end
end
end
end)
local function roundTimer()
while wait() do
for i = preroundLength, 1, -1 do
local Click = game.Workspace.GameSpawn.TimerClick
Click:Play()
InRound.Value = false
wait(1)
Status.Value = “Preround: “… i …” seconds left!”
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1)
Status.Value = “Game: “… i …” seconds left!”
end
end
end
spawn(roundTimer)
game.ReplicatedStorage.WaitingOut.OnServerEvent:Connect(function(PLRpressed)
local WaitingOutButtonPress = PLRpressed
print(WaitingOutButtonPress)
for Index, Player in pairs(PLRwaitingList) do
if Player == PLRpressed then
table.remove(PLRwaitingList, Index)
end
end
print(PLRwaitingList)
end)
game.ReplicatedStorage.WaitingForAGame.OnServerEvent:Connect(function(PLRpressed)
local AwaitingGameButtonPress = PLRpressed
print(AwaitingGameButtonPress)
table.insert(PLRwaitingList, AwaitingGameButtonPress)
print(PLRwaitingList)
end)
Any help is appreciated!