I've been making a GUI with
RemoteEvents and all which is supposed to teleport you to a desired player's position. The fact is I've done everything else, verified with
print()s, but so far the closest I've got to actually moving the player is changing where the character is facing. Please let me know if you know how to move the character!
Edit: An admin left me a note to include some code, so here it is:
if targetTorso then print(targetTorso.Position) --Teleport the player, not done yet. print("Target torso: " .. tostring(targetTorso.Position) .. " Admin torso: " .. tostring(adminTorso.Position)) end
adminTorso is the torso of the person who is trying to teleport, and
targetTorso is the torso of the person who the admin is trying to teleport.
Just check their character's CFrames and move one's HumanoidRootPart to the CFrame of the other.
The wiki has a good article on teleporting.
For teleporting one player to another, you can use something like this.
local function teleportPlayer(target,endPlayer) -- target will be teleported to endPlayer if target.ClassName == "Player" and endPlayer.ClassName == "Player" then -- check if they're both players local endPlayerCharacter = endPlayer.Character or endPlayer.CharacterAdded:Wait() -- make sure they have a character/wait for one if they don't, this is optional I guess target.Character:WaitForChild("HumanoidRootPart").CFrame = endPlayerCharacter:WaitForChild("HumanoidRootPart").CFrame -- position them end end