Hello fellow developers, since the new proximity prompt feature came out a while ago, I was wondering if there was a way I could actually create a script that makes a proximity prompt work only client-sided when a player holds out a specific tool. If you could give me an awesome example of how I could achieve this, it’ll be greatly appreciated. I kind of understand what I’m needing to achieve this, however, I can’t think of a good way of planning this out and how I could get this to only work client-sided when a player has a specific tool out. If the tool is put away, the prompt disables for their client. If the tool is out, then only their client would be able to use the proximity prompt.
Example: If a player has a key in their hand, the proximity prop only appears on their client and they’ll be able to use it since they only have the tool. However, when the tool isn’t equipped, then the proximity prompt won’t appear.
The funny is, you could entirely do this all in a LocalScript alone
Do keep in mind though, that LocalScripts only work client-sided so you’d need to put it in StarterPlayerScripts
I believe how you could do it, is detect a change for when a Player’s Character gets a Tool added inside its Model using a ChildAdded & ChildRemoved event:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Prompt = workspace.Part.ProximityPrompt
Character.ChildAdded:Connect(function(Child)
if Child.Name == "SpecificToolName" then
Prompt.Enabled = true
end
end)
Character.ChildRemoved:Connect(function(Child)
if Child.Name == "SpecificToolName" then
Prompt.Enabled = false
end
end)
These Events pretty much fire when a object gets added/removed to the Character’s Model, and we can check if the name is equal to the Tool we want the prompt to enable/disable
I too want to make a client-side Proximity Prompt 'cause I’m trying to make it disappear for the Client but not for the rest of the players when triggered (aka Server)