ProximityPrompt tutorial: Only active one:

Hello !
I have seen several posts from people who don’t know how to use ProximityPrompt.
Because when there are multiple ProximityPrompt in the game and you activate one, it will activate all the other ProximityPrompt in the game.
If you are also having this problem and are not good at scripting, here is a solution:

promptObject is this image but remember this is not a ClickDetector
the attachement is just the position of the gui image and you can rename it if you want.
**The script is in the attachement so script.Parent.ProximityPrompt is the ProximityPrompt and script.Parent.Parent is the Part.

Exemple of script:

local function onPromptHoldEnded(promptObject, player)
	if promptObject == script.Parent.ProximityPrompt then
		script.Parent.Parent.BrickColor ="Lime green")

I hope it will be useful for you :smiley:
Have a great day :slight_smile:
Oh and… Merry Christmas :santa: :gift:


You didn’t need the else statement in the example code btw.


Oups, yes… when i made some tests i forgot to remove this…

Why aren’t you just using the Triggered event?

-- do stuff

So far, it works fine for me and it never activated any other ProximityPrompt. Honestly, if it does then it sounds unintentional and more like a bug to me.

edit: tested it again just now in studio and as expected, only the proximityprompt that I called gets activated, the rest doesn’t.


i said Exemple of script so it’s just an exemple.image

Oh and… if it don’t work, then try this:
Thank, @astra_wr for the idea.

YourProximityPrompt.Triggered:Connect(function(promptObject, player)
      -- add your function here

Sorry for bumping the topic, but this would be a much more efficient script than the one you wrote:
(Create a proximity prompt inside of a part and then add this script inside of the proximity prompt)

	script.Parent.Parent.Color = Color3.fromRGB(0, 255, 0)

Also, this is a very simple tutorial, and it would be useful for a very small amount of people.