So I'm trying to make the players from each team to spawn at each random part from a spawn group position in each map that spawns. This is the code I have so far:
Players.PlayerAdded:Connect(function(player)
local mapd = game.ServerStorage.Maps:FindFirstChild("BasicMap")
local bluespawns = mapd:FindFirstChild("BlueSpawns"):GetChildren()[math.random(1,6)]
local yellowspawns = mapd:FindFirstChild("YellowSpawns"):GetChildren()[math.random(1,6)]
local bluetarget = CFrame.new(472.672, 0.363, 64.623)
local yellowtarget = CFrame.new(434.852, 0.363, 329.673)
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
if player.Team == game:GetService("Teams").Blue then
player.Character:WaitForChild('Torso').CFrame = CFrame.new(bluespawns.Position + Vector3.new(0,2.5,0))
elseif player.Team == game:GetService("Teams").Yellow then
player.Character:WaitForChild('Torso').CFrame = CFrame.new(yellowspawns.Position + Vector3.new(0,2.5,0))
end
end
end
end)
It works locally but not in-game/FE, please help!

4 comments
is this a local script because you cant use playeradded on it
more information: errors, if any? type of script & location
Oh sorry, there is no errors through the output and this is a normal script in the serverscriptservice.
Do you have a spawns folder?