Detect if proximity prompt was triggered

Hello!
I’m trying to make a script where it’ll detect how many times an certain proximity prompt got triggered, but I don’t know how, it isn’t documented anywhere, and there’s no posts regarding my issue. How would I go about that?

2 Likes

You will want to use its Triggered event, and increment a counter each time it is.

local counter = 0

proximity_prompt.Triggered:Connect(function(player)
    counter += 1
    -- do stuff
end)
5 Likes

Alright! I’ll try it out and see if it works.

It works, thank you! :slight_smile:

Make sure to mark his post as a solution so we know that your thread is closed and already has a solution!

You can also see the Proximity Prompt Developer hub page

1 Like

Well I did see it, I’m just new to scripting and couldn’t really find anything regarding my question.

1 Like