✓ Accepted answer
function teleAll()
local pos= game.Workspace.FlightModel.PlayerHolder.CFrame
for _, plr in pairs(game:GetService("Players"):GetPlayers()) do
if plr.Character then
plr.Character.HumanoidRootPart.CFrame = pos
end
end
end
teleAll()
print("done")
Basically, what we've changed here, is 2 things. first of all, the pos variable. The reason of this change inherits from the following change, so let's jump there. I'd recommend changing the CFrame of the humanoidrootpart more than using moveto because of various things:
- MoveTo, or changing torso's positions can cause death to the character
- There is no sort of 'collisions' when teleporting the characters, so the character will be teleported in that place correctly.
- I've changed the position of the part to the CFrame to the part so we could change the HRP's CFrame, although you can make a new cframe with the position. Tip: if you ever need the position of a CFrame you can use CFrame.P
hope this helped!
2 comments
MoveTo sometimes does weird things. Use CFrame
I'm not really good at Using CFrame