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

How Can I Make An Action Execute After The Hold Duration Of The Prompt Is Done ?

Asked by
Split_s 21
2 years ago

So I Have This "Problem/Misunderstanding" , When I Interact With My Proximity Prompt , After The 5 Second Hold Duration , I Need To Release The Key In Order For The Script To Be Executed . How Could I Make It So When The Hold Duration Is Done I Don't Necessarily Need To Release The Key In Order For The Action To Be Completed . Sorry If My Explanation Was All Over The Place But Here Is The Script And The Example.

Script:

-- The Variables
local prompt1 = script.Parent.Break1.ProximityPrompt
local prompt2 = script.Parent.Break2.ProximityPrompt
local break1 = script.Parent.Break1
local break2 = script.Parent.Break2
local Branches = script.Parent.Branches
local barrier = script.Parent.Barrier
local sound = script.Parent.Sound

-- The Function
break1.ProximityPrompt.TriggerEnded:Connect(function(plr)
    sound:Play()
    Branches.Transparency = 1
    Branches.CanCollide = false
    prompt1.Enabled = false
    prompt2.Enabled = false
    barrier.CanCollide = false
    wait(60)
    Branches.Transparency = 0
    Branches.CanCollide = true
    prompt1.Enabled = true
    prompt2.Enabled = true
    barrier.CanCollide = true
end)

break2.ProximityPrompt.TriggerEnded:Connect(function(plr)
    sound:Play()
    Branches.Transparency = 1
    Branches.CanCollide = false
    prompt1.Enabled = false
    prompt2.Enabled = false
    barrier.CanCollide = false
    wait(60)
    Branches.Transparency = 0
    Branches.CanCollide = true
    prompt1.Enabled = true
    prompt2.Enabled = true
    barrier.CanCollide = true
end)

Example:

Streamable

1 answer

Log in to vote
0
Answered by
Split_s 21
2 years ago

Ok , I Just Realized The Problem , Instead Of:

break1.ProximityPrompt.TriggerEnded:Connect(function(plr)

I Should Have Typed

break1.ProximityPrompt.Triggered:Connect(function(plr)

(((((:

Ad

Answer this question