ProximityPrompt not disabling

Hi, I’ve been frustrated for days because my ProximityPrompt is not disabling, and I don’t know why. I’m starting to think it’s because this ProximityPrompt is getting enabled in a localscript could that be the case?

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
script.Parent.ProximityPrompt.Enabled = false
end)
2 Likes

Sounds like you’re trying to run a client script from the workspace, which is not possible. Client scripts can only run if they’re descendants of certain things, and the workspace isn’t one of them (more information here). As a workaround, I suggest putting the code in a server script then setting the script’s RunContext property to Client.

2 Likes

Is it a LocalScript that you’re using?

If so, it won’t run as it is a descendant of the workspace. A LocalScript must be a descendant of:

  • Player’s backpack
  • Player’s character model
  • Player’s PlayerGUI
  • Player’s PlayerScripts
  • ReplicatedFIrst service

Thus you should make the function execute in a LocalScript located in one of the mentioned locations, preferrably the StarterPlayerScripts for ease. Make a variable for the ProximityPrompt in the workspace and connect a function to the trigger as per usual.

1 Like

Its a local script enabling the proximityprompt but the script i sent here is a server script

1 Like

The LocalScript will never run since it’s in the Workspace. The proximity prompt will not have anything enabling it.

1 Like

The local script enabling it is in StarterGui its just there for enabling the proximityprompt like i said the script i sent here is a server script

1 Like

Yes since your activating it only on the client and not replicating to the server the server is tracking that the prox prompt is not enabled to begin with.

Try using a remove event and see if that helps you out.

1 Like

The script you put here is going off what the server sees, which, according to my understanding, is Enabled being set to false. Enabling the proximity prompt on the client does nothing because the server doesn’t see it as enabled as well. Is there any reason the prompt couldn’t already be enabled when the game starts?

Yeah, I just tried that, and it now disables. Thank you so much for helping, i’ve been trying for days to get this to work.

1 Like

The game I’m making is round-based, so the ProximityPrompt couldn’t really be enabled at the start of the game.

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