Teleport a player to a new postition using proximity prompt!

Hello! And welcome to my tutorial! Today I will be showing you how to make a proximity prompt teleport a player to a new location. So first make your proximity prompt under a part and add a Normal Script Under the Proximity Prompt It should look like this:
Screenshot 2023-10-22 134717

Now lets get scripting!

First we make the variables

local proximity = script.Parent
local Location = game.Workspace.Location -- put the part you want to teleport to here

Then, we add a function, like this

ProximityPrompt.Triggered:Connect(function(Player)
-- we will put stuff here in a second
end)

Then, we find the player that activated it and teleport them.

ProximityPrompt.Triggered:Connect(function(Player)
	Player.Character.HumanoidRootPart.Position = Location.Position
end)

Your script should look something like this:

local ProximityPrompt = script.Parent 
local Location = game.Workspace.Location
ProximityPrompt.Triggered:Connect(function(Player)
	Player.Character.HumanoidRootPart.Position = Location.Position
end)

Did it work? If there was any problems let me know!

4 Likes

The way this tutorial was written was extremely hard to comprehend, given the poor formatting and repeated lines of code that people copy-pasting will unknowingly duplicate. And then their script will end up looking nothing like the end product.

You also should make it more clear there should be two parts, the Teleporter and the Location part.

If I wasn’t any wiser and just simply copy and pasted the lines without looking at what you said it should look like:

But here’s the functioning script in a more readable format:

local ProximityPrompt = script.Parent
local Location = game.Workspace.Location

ProximityPrompt.Triggered:Connect(function(Player)
	Player.Character.HumanoidRootPart.Position = Location.Position
end)

And the script in action:


Besides all that, I did actually want to have a teleport script via interactive part, so I’ll give thanks.

4 Likes

Sorry this is my second tutorial :confused:

Any tips on how to make the code like that? It wasnt working for me sry @VGVC2 .

I edited the code, any tips now?

You should be using workspace instead of game.Workspace, everything else looks good though.

1 Like