ProximityPrompt only works once

Wait, did you re-parent the LocalScript to where it can run?.. There are certain places it can run, which aren’t all the same as Scripts. This is important.

Where do I have to put the script?

Straight from the docs:

A LocalScript will only run Lua code if it is a descendant of one of the following objects:

  • A Player’s Backpack , such as a child of a Tool
  • A Player’s character model
  • A Player’s PlayerGui
  • A Player’s PlayerScripts .
  • The ReplicatedFirst service

You need to change the paths in your code when you change your LocalScript’s location. Otherwise your code never works either.

Well then that’s a huge problem because I have hundreds of these proximity prompts. That will take days to do.

If you have hundreds of prompts, you shouldn’t be modifying them manually. Heck, you shouldn’t have created them manually in Studio? That’s torture. You should create them through scripts for ease of use.

This must be the reason why your code’s messed up. Parents always matter, for scripts especially.

Is there an easier way to do this? I don’t feel like spending hours of copy and pasting

Well, what exactly are you using so many prompts for? Like I said, generating them through code (all depends) or perhaps using the Command Bar to do operations on them could work.

Maybe Proximity Prompts are overkill for your reason too. I just need to know what you’re using them for.

So I am making a guess the logo type game. And for every part with a decal, there is a proximity prompt that players can use to skip the level. If they don’t have enough skips, the gui shows up and they can buy them. If they do, the door becomes transparent, can collide turns off, etc.

Alright, so there is a basic issue here. You can’t for example disable a proximity prompt with a SCRIPT and then disable it with a LOCAL SCRIPT. This is because, the other script still sees it as that script has made it. So, you need to fire it to a remote event, then make it enable/not enable in the LOCAL SCRIPT.

2 Likes

May I ask something? You didn’t add the debounce, the variable-

local on = false