Alright, so I’m messing up the player value (b) that is supposed to transfer individual players to a function. Think im completely off with the script itself, but it’s worth a try i guess. Anyone know how to fix it?
local cachedSpawns={}
local playersPlaying={}
function StartGame(b)
local character = b.Character or b.CharacterAdded:wait()
if character then
StartGame()
event:FireClient(b, {reason="HideGuis"})
wait(.3)
event:FireClient(b,{reason="CloseScreen"})
wait(2.7)
local randomSpawn = map.Spawns:GetChildren()[Random.new():NextInteger(1,#map.Spawns:GetChildren())]
if cachedSpawns[randomSpawn] then
repeat randomSpawn = map.Spawns:GetChildren()[Random.new():NextInteger(1,#map.Spawns:GetChildren())] wait() until not cachedSpawns[randomSpawn]
end
cachedSpawns[randomSpawn] = true
character:WaitForChild('Humanoid').WalkSpeed = 0
character:WaitForChild('Humanoid').JumpPower = 0
character:SetPrimaryPartCFrame(randomSpawn.CFrame*CFrame.new(0,2.75,0))
table.insert(playersPlaying,b.UserId)
wait(2)
event:FireClient(b,{reason="OpenScreen"})
wait(0.7)
--Countdown
event:FireClient(b,{reason="Countdown"})
wait(5.25)
event:FireClient(b,{reason="Audio",file="164486422"})
end
end
for a,b in ipairs(game.Players:GetPlayers()) do
StartGame(b)
end