Proximity Prompt teleportation issues

  1. What do you want to achieve? I want two proximity prompts to be able to teleport the player to different locations.

  2. What is the issue? When i use one proximity prompt, the other one just doesn’t want to work
    Here is the video:
    robloxapp-20230401-1406051.wmv (1.3 MB)

  3. **What solutions have you tried so far?**I have tried to look at Youtube tutorials too see if i did something wrong, but nothing worked, I’ve even tried to look at the forum.


local Proximity_Part = script.Parent
local Prompt = Proximity_Part:WaitForChild("ProximityPrompt")

--[Teleport Destinations]
local Teleport_Folder = game.Workspace:FindFirstChild("TeleportParts")
local TP1, TP2 = Teleport_Folder:FindFirstChild("Outside_Teleport"), Teleport_Folder:FindFirstChild("Basement_Teleport")

Prompt.Triggered:Connect(function(plr)
	local char = plr.Character
	local root = char.HumanoidRootPart

	root.Position = TP1.Position
end)

First, you shouldnt change the position of the root part. You should just use :PivotTo() instead. (Which is why that function exists)

Second, you might have accidentally left the part unachored which maybe caused it to go out of bounds.

1 Like

I’m pretty sure you need to change root.Posiiton to root.CFrame and you need to change TP1.Position to TPI.CFrame.

1 Like

I think I found the issue. I changed the code to char:MoveTo(TP1.Position) and it seemed to work. But thanks for the help anyway. Also the part is anchored

Oh ok no problem glad you figured it out :slight_smile: .

1 Like

Oh yea, Do not use MoveTo. Use PivotTo(). Moveto will teleport you ontop of a part if the place is not clear.

char:PivotTo(TP1:GetPivot)

This also seems to work. So I’ll just mark this as the solution. thx

Prompt.Triggered:Connect(function(plr)
	local char = plr.Character
	local root = char.HumanoidRootPart
	
	print("basement")
	root:PivotTo(CFrame.new(TP1.Position))
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.