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 3 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.

01local prox = game:GetService("ProximityPromptService")
02 
03local function onPromptTriggered(promptObject, player)
04    if promptObject == script.Parent then
05        local chr = player.Character
06        if chr then
07            local humroot = chr:FindFirstChild("HumanoidRootPart")
08            if humroot then
09                humroot.Position = Vector3.new(313.25, -580.087, -267.5)
10            end
11        end
12    end
13end
14 
15prox.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 — 3y

1 answer

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

Use ProximityPrompt.Triggered instead

01local prox = script.Parent -- change to the proximity prompt object
02 
03local function onTriggered(player)
04        local chr = player.Character
05        if chr then
06            local humroot = chr:FindFirstChild("HumanoidRootPart")
07            if humroot then
08                humroot.Position = Vector3.new(313.25, -580.087, -267.5)
09            end
10        end
11end
12 
13prox.Triggered:Connect(onTriggered)
Ad

Answer this question