Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

ProximityPrompt Teleportation not working as intended?

Asked by 2 years ago

Hey, I'm trying to make a set of stairs that teleport to eachother when you use them. When I first put a script in, it worked, but you could hold you any amount of time and it worked. I had been requested by another developer to make sure it is after the delay, so I changed it a little, but nothing happened no matter how long you hold.

local prox = game:GetService("ProximityPromptService")

local function onPromptTriggered(promptObject, player)
    if promptObject == script.Parent then
        local chr = player.Character
        if chr then
            local humroot = chr:FindFirstChild("HumanoidRootPart")
            if humroot then
                humroot.Position = Vector3.new(313.25, -580.087, -267.5)
            end
        end
    end
end

prox.PromptTriggered:Connect(onPromptTriggered)

The method that worked but not as expected utilized PromptButtonHoldEnded().

Any way anyone can help this?

0
Prompt triggered works when hold duration is 0 SuperPuiu 497 — 2y

1 answer

Log in to vote
0
Answered by
3F1VE 257 Moderation Voter
2 years ago

Use ProximityPrompt.Triggered instead

local prox = script.Parent -- change to the proximity prompt object

local function onTriggered(player)
        local chr = player.Character
        if chr then
            local humroot = chr:FindFirstChild("HumanoidRootPart")
            if humroot then
                humroot.Position = Vector3.new(313.25, -580.087, -267.5)
            end
        end
end

prox.Triggered:Connect(onTriggered)
Ad

Answer this question