So I have used the Teleport Module and Teleport on Part Touch script from Teleporting Within a Place but changed it slightly to work with a proximity prompt. I’ve kept the Teleport Module the same but I’ve edited the Teleport on Part Touch script to this:
Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local proximityPrompt = script.Parent.ProximityPrompt
local TELEPORT_DESTINATION = Vector3.new(50, 0, 50)
local TELEPORT_FACE_ANGLE = 0
local FREEZE_CHARACTER = true
-- Require teleport module
local TeleportWithinPlace = require(ReplicatedStorage:WaitForChild("TeleportWithinPlace"))
local function teleportPlayer(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid and not humanoid:GetAttribute("Teleporting") then
humanoid:SetAttribute("Teleporting", true)
local params = {
destination = TELEPORT_DESTINATION,
faceAngle = TELEPORT_FACE_ANGLE,
freeze = FREEZE_CHARACTER
}
TeleportWithinPlace.Teleport(humanoid, params)
wait(1)
humanoid:SetAttribute("Teleporting", nil)
end
end
proximityPrompt.Triggered:Connect(teleportPlayer)
It used to work when I touched the part but now that I’ve switched it to a proximity prompt it doesn’t do anything when I trigger it. Does anyone know the fix?