This is the main script for my first game project. Everything works fine up until the changing teams and teleportation/section. When play testing in a local server everything seems to be in order, however when I bring a friend in to test in play mode only I am teleported and teamchanged. Thank you for your help! :)))
game.workspace.players.playersIngame.Changed:connect(function(initialstart) wait (5) local playersIngame = game.workspace.players.playersIngame.Value local children = game.Players:GetChildren() if playersIngame >= 2 and playersAlive == 0 then print ('The first game needs to be started') workspace.mapsIngame:ClearAllChildren() print ('First round initialized') wait (initaltime) print ('Loading new map') for i,v in pairs(Maps) do if randomMap == i then storage = game:GetService('ReplicatedStorage') local map = storage.Maps:WaitForChild(v):Clone() map.Parent = workspace.mapsIngame print ('Map loaded') wait (initaltime) print ('Changing teams') for index, child in pairs(game.Players:GetChildren()) do child.TeamColor = BrickColor.new("Really black") wait (initaltime) print ('Teleporting players and resetting values') local a = game.Players:GetChildren() for _,v in pairs (a) do if v.Character then v.Character.Torso.CFrame = CFrame.new(Vector3.new(math.random(1,100),math.random(1,100),math.random(1,100)),v.Character.Torso.Position) playersAlive = playersIngame print ('Let the games begin') end end end end end end end)