How to detect a Proximity Prompt

I was wondering, is there a way to detect when a player is shown ANY proximity prompt in a game?

I know with PromptShown function it’s possible, but I don’t want to make a local script for every single prompt in my game. (there are a lot)

Any help is appreciated!

1 Like
for _,v in workspace.Proms:GetChildren() do
     if v:IsA("ProximityPrompt") then
        v.PromptShown:Connect(function()
            print("lol")
         end)
     end
end

A better solution is to use tags.

1 Like

ProximityPrompService helps with this:

local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptShown:Connect(function(prompt)
    --your code
end)

It will activate whenever any prompt is shown.

1 Like

This worked perfectly, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.