How to stop proximity prompts from being visible / activatable by certain users

Hi there!

I’m trying to create a proximity prompt which is not accessible (but more preferably not visible to a certain user). The premise is that the user will have a bomb attached to themselves but SOMEBODY ELSE needs to defuse it for them, via using a proximity prompt. The bomb will be parented to the character’s model.

This is what I currently have…

local ProxPrompt = script.Parent.ProxPrompt
local BombModel = script.Parent.Parent

ProxPrompt.Triggered:Connect(function(player)
	if player.Name == BombModel.Parent.Name then
		return
	else
		Defusal()
	end
end)

…but it does not work. (As in Defusal() works as intended, but is run even when it shouldn’t)

Any assistance on what I’ve got missing here would be great, and maybe some tips on how to make the prompt not visible to the user which the bomb is parented to, as that would make it much easier!

Thank you.

When something is done in a LocalScript, it will only be done for one player’s client and not replicated to the server, where other players would see this change. Based on the problem you are having, I assume the bomb is being parented to the player in a LocalScript, while the code inside the bomb is a server script. If I’m wrong then please provide more information.

Test the game in Studio and make sure the bomb model is parented to the character on both the player’s client side AND on the server side by using the switch button next to the play button when you start.

Additionally, you could make this prompt not appear for a player by disabling it in a function in a LocalScript which only runs for them.

Hi!

Currently as it stands, everything relating to the bomb is occurring on the server. So it isn’t a of matter of it not being replicated to the server. I just want to figure out how feasible it is to restrict it to another user’s responsibility to defuse.

This best sums up what I’d like to do, definitely is what I was going for but slipped my mind. How would I go about disabling proximity prompt specifically for the user who has the bomb?

put this in a localscript in startercharacterscripts

script.Parent.ChildAdded:Connect(function(child)
	if child.Name == "Bomb" then
		child.ProximityPrompt.Enabled = false
	end
end)

Works like a charm! Thank you!!