How do I make the script so that when a server is created the spectating value is running at the same time because it seemed like if a player was waiting and a new player joined the old player would be in the game before the new player?
local Players = game:GetService("Players") local spectating = true local inGame = false Players.PlayerAdded:Connect(function(player) local debounce = Instance.new("BoolValue", player) debounce.Name = "GameDebounce" while true do wait() if spectating == true and inGame == false and not debounce.Value then player.Team = game.Teams.Spectators print("Player is spectating") wait(30) print("Starting Game") spectating = false inGame = true debounce.Value = false elseif spectating == false and inGame == true and not debounce.Value then player.Team = game.Teams.Players print("Game has started") local char = player.Character or player.CharacterAdded:Wait() char:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-8.92, -2.17, 27.27))) debounce.Value = true end end end)