Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

Ok , I Just Realized The Problem , Instead Of:

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

I Should Have Typed

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

(((((:

This discussion is preserved as it was. New answers, comments, and votes are closed.