Does anybody know the causes/symptoms of this and what might be happening? I’m still a fairly new programmer (just started maybe two or three weeks ago) and am still inexperienced.
I have a script on the Server side basically teleporting players from the lobby into the game area. In the game area there’s random spots where they can teleport to, however, they’re all getting teleported into the same spot.
Here’s an example of what I’m doing:
randomSeat = table.remove(seatArray, math.random(#seatArray));
for i, players in ipairs(game.Teams.Spectators.GetPlayers()) do
if players.Character and players.Character:FindFirstChild("HumanoidRootPart") then
players.Character.HumanoidRootPart.CFrame = randomSeat.Seat.CFrame;
end
end
I’m also not sure if it’s because I put it in a function like this either:
players.PlayerAdded:Connect(function(player)
The randomSeat variable is on the outside of the for-loop encasing the for-loop for the second set of code (if that makes any sense). Example:
for i, players in ipairs(game.Teams.Spectators:GetPlayers()) do
randomSeat = table.remove(seatArray, math.random(#seatArray));
...
...
for i, players in ipairs(game.Teams.Spectators.GetPlayers()) do
if players.Character and players.Character:FindFirstChild("HumanoidRootPart") then
players.Character.HumanoidRootPart.CFrame = randomSeat.Seat.CFrame;
end
end
...
...
end