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!