Issue with ProximityPrompts

So I’ve been having a problem with my ProximityPrompts. In my prompts, I have a script that temporarily disables the prompt, so the prompts have a cooldown and players can’t use it more than once.
Also, each prompt has a Holdtime of 0, so you don’t have to hold the button.
However, I’ve found that on slower mobile devices, this script won’t update in time, and players can use the prompts multiple times. Also, players with a mouse can spam click the prompt, and it will fire multiple times.
I have a temporary solution to this, by setting the HoldTime to a higher number, usually half a second or so. But, is there any way to actually fix this issue?

1 Like

you should do this

local prox = script.Parent.ProximityPrompt
local debounce = false

prox.Triggered:Connect(function(plr)
if debounce == false then
debounce = true
task.wait(2)
debounce = false
end
end)

Make it a local script so low-end devices can’t click multiple times. But you shouldn’t really need to. Let me know if it works or not.

2 Likes

Does the proximityprompt have any problems anymore?

1 Like

Try putting this in a LocalScript:

ProximityPrompt.Triggered:Connect(function(player)
    ProximityPrompt.Enabled = false
    wait(2)
    ProximityPrompt.Enabled = true
end)
2 Likes

I would use task.wait as its a better version of wait.

1 Like

@ForgetableLife This worked, thanks!

@Intrance That’s what I had before and was having problems with. Thanks for trying to help though!

1 Like

You should use debounces to pervent the player from mass clicking something. im gonna go eat

1 Like