This script used to work, then I tried adding a way to check if there is 2 or more players and the status never changed. I'll put comments everywhere to explain what the part of the script does, and tell me which part is broken. Thanks!
-- Variables are set up here
local IntermissionLength = 10
local RoundLength = 10
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local HomePlatform = game.Workspace.HomePlatform
local TilePlatform = game.Workspace.TilePlatform
-- Checks if InRound is changed, and teleports them to the area they get teleported to.
InRound.Changed:Connect(function()
print(InRound.Value)
if InRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = TilePlatform.CFrame
end
elseif InRound.Value == false then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = HomePlatform.CFrame
end
end
end)
-- The intermission timer
local function Timer()
-- Check if there are enough players (Where I'm 90 percent sure it went wrong)
local plrcount = 0
game.Players.PlayerAdded:Connect(function()
for i,v in pairs(game.Players:GetChildren()) do
plrcount = plrcount + 1
end
end)
while plrcount >= 1 do
Status.Value = "Not enough players!"
for i = IntermissionLength, 0, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission for "..i.." more seconds!"
end
for i = RoundLength, 0,-1 do
InRound.Value = true
wait(1)
Status.Value = "Game going on for "..i.." more seconds!"
end
end
while plrcount == 1 do
Status.Value = "Not enough players!"
end
end
