How to teleport a player to an exact position

So I’m making a menu where I want the player to teleport to the house when he presses the play button in the menu but I don’t know how it’s done so I need your help

20 Likes
Character.HumanoidRootPart.CFrame = CFrame.new(1,5,9) -- you can change them
17 Likes

Create a RemoteEvent that the client will fire when it is clicked on. In the parameters, be sure to include the player.

On a server script, receive the event and use the player instance that was sent and find it’s HumanoidRootPart in the workspace. Then move the player’s HumanoidRootPart to the house.

Example:

—Client, inside of button
local plr = game.Players.LocalPlayer
local workspaceplr = game.Workspace:FindFirstChild(plr.Name)
local event = game.ReplicatedStorage.Event —You need to change this to the name of the RemoteEvent
local button = script.Parent

button.MouseButton1Click:Connect(function()
event:FireServer(workspaceplr)
end)

—Server, anywhere basically
local event = game.ReplicatedStorage.Event —You need to change this to the name of the RemoteEvent

event.OnServerEvent:Connect(function(plr)
plr.HumanoidRootPart.CFrame = CFrame.new(0, 0, 0) —Change this to the Position of where you want the player to go
end)
7 Likes
local teleportPart = -- the part that the character teleports to

script.MouseButton1Click:Connect(function()
   game.Players.LocalPlayer.Character.HumanoidRootPart:MoveTo(teleportPart.Position)
end)
6 Likes

I don’t think they asked for the player to move. They asked for the players character to be teleported.

4 Likes

u know how to script, don’t ya? it’s a script to teleport the character not the player

3 Likes

First of all, I believe you do this on the server?

Second, :MoveTo() moves it, not teleports it.

Here’s a video:

2 Likes

But :MoveTo makes the character walk…

6 Likes

That’s what you should use it for, the Humanoid, not HumanoidRootPart. Use CFrame.new for teleporting HumanoidRootPart.

5 Likes

it didn’t work

(MoveTo is not a valid member of Part “Workspace.ANRTNT.HumanoidRootPart”)

2 Likes

Did you do .MoveTo or :MoveTo? Also, please show what you just typed.

2 Likes

game.Players.LocalPlayer.Character.HumanoidRootPart:MoveTo(teleportPart.Position)

2 Likes

You need to find the workspace Player.

Something like this:

local plr = game.Players.LocalPlayer
local workspaceplr = game.Workspace:FindFirstChild(plr.Name)
3 Likes

{68F9150F-1D9B-4368-A956-2CE3FF98344B}.png
I have those as well

2 Likes

Then do something like this:

workspaceplr.character.humanoidrootpart:MoveTo(teleportPart.Position)
2 Likes

character is not a valid member of Model “Workspace.ANRTNT”

2 Likes

MoveTo is a function of models, not parts, use Character:MoveTo(position) rather than Character.HumanoidRootPart:MoveTo(position)

3 Likes

still the same error got before

3 Likes

Try removing Character from the script?

2 Likes

humanoidrootpart is not a valid member of Model “Workspace.ANRTNT”

wow new errors keep appearing

2 Likes