ProximityPrompts within player models besides localplayer

Hello! I’m having an issue with the new ProximityPrompts. I want to be able to put these ProximityPrompts in players model besides the localplayer’s. I’ve gotten a start to try and make this work, but I believe I need a better way to achieve my goal.

What I do not want to happen:


ProximityPrompts are in Player1 and Player2. The prompts in the other player are there, just hidden because there’s one closer than the other.

Here is my code so far:
Please read the comments in the code.

--local script within startercharacterscripts
local Players = game:GetService("Players")
local localName = Players.LocalPlayer.Name

--when player is added
local function onPlayerAdded(player)
	--get joined player's name
	local PName = player.Name
	--if the player's name is not the localplayer's
	if not PName == localName then --problem is here, i cant think up of a solution
		--give prox prompt
		print("Giving prox prompt to: " .. player.Name)
		local p = Instance.new("ProximityPrompt")
		p.Parent = game.Workspace:WaitForChild(PName)
		p.ActionText = "Hug"
		p.HoldDuration = 1
	end
end

for _, player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end

Players.PlayerAdded:Connect(onPlayerAdded)

If anyone has any improvements to this (or an entirely different approach that could work instead), please let me know. Thank you! :slight_smile:

You could delete it on the client with a localscript

1 Like

No idea why I didn’t think of this, I think I need some sleep. Thank you!