Having trouble getting ProximityPrompt to appear

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I am trying to create a ProximityPrompt to parent each player’s character HumanoidRootPart on the server except the local player.

  1. What is the issue? Include screenshots / videos if possible!

The ProximityPrompt does not appear or it some hows parents itself to the local player.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Devfourm and testing with friends.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Client:
local Plr=game.Players.LocalPlayer

local Remote_Events=game.ReplicatedStorage.Remote_Events

game.Players.PlayerAdded:Connect(function(Other_Plr)

Other_Plr.CharacterAdded:Connect(function()
	
	wait()
	
	if Other_Plr.Name~=Plr.Name then

		Remote_Events.ProximityPrompt:FireServer(Other_Plr)

	end
	
end)

end)

for _,Other_Plr in pairs(game.Players:GetChildren()) do

if Other_Plr.Name~=Plr.Name then
	
	Remote_Events.ProximityPrompt:FireServer(Other_Plr)
	
end

end

while wait() do

local HumanoidRootPart=Plr.Character:WaitForChild("HumanoidRootPart")

if HumanoidRootPart then
	
	local ProximityPrompt=Plr.Character.HumanoidRootPart:FindFirstChild("ProximityPrompt")
	
	if ProximityPrompt then

		ProximityPrompt:Destroy()

	end
	
end

end

Server:
Remote_Events.ProximityPrompt.OnServerEvent:Connect(function(Plr,Other_plr)

print(Other_plr)

Main_Modules.ProximityPrompt(Other_plr)

end)

Module:
function Main_Modules.ProximityPrompt(Other_plr)

local ProximityPrompt=Instance.new("ProximityPrompt")
ProximityPrompt.Parent=Other_plr.Character.HumanoidRootPart
ProximityPrompt.HoldDuration=1
ProximityPrompt.ActionText="Steal"
ProximityPrompt.ObjectText="@"..Other_plr.Name

end

1 Like

This is kind of hard to read, could you try formatting the code a bit better?

Use three backticks at the start and end of the code block. "

How? I cant figure it out. I used ’ and ~ but it does not work.

Client:

local Plr=game.Players.LocalPlayer

local Remote_Events=game.ReplicatedStorage.Remote_Events

game.Players.PlayerAdded:Connect(function(Other_Plr)
	
	Other_Plr.CharacterAdded:Connect(function()
		
		wait()
		
		if Other_Plr.Name~=Plr.Name then

			Remote_Events.ProximityPrompt:FireServer(Other_Plr)

		end
		
	end)
	
end)

for _,Other_Plr in pairs(game.Players:GetChildren()) do
	
	if Other_Plr.Name~=Plr.Name then
		
		Remote_Events.ProximityPrompt:FireServer(Other_Plr)
		
	end
	
end

while wait() do
	
	local HumanoidRootPart=Plr.Character:WaitForChild("HumanoidRootPart")
	
	if HumanoidRootPart then
		
		local ProximityPrompt=Plr.Character.HumanoidRootPart:FindFirstChild("ProximityPrompt")
		
		if ProximityPrompt then

			ProximityPrompt:Destroy()

		end
		
	end
	
end

Server:

Remote_Events.ProximityPrompt.OnServerEvent:Connect(function(Plr,Other_plr)
	
	print(Other_plr)
	
	Main_Modules.ProximityPrompt(Other_plr)
	
end)

Module:

function Main_Modules.ProximityPrompt(Other_plr)
	
	local ProximityPrompt=Instance.new("ProximityPrompt")
	ProximityPrompt.Parent=Other_plr.Character.HumanoidRootPart
	ProximityPrompt.HoldDuration=1
	ProximityPrompt.ActionText="Steal"
	ProximityPrompt.ObjectText="@"..Other_plr.Name
	
end