So im makeing handcuffs in my game and what im doing is that when someone hold's the handcuffs it detect the colest player by them and adds a proximityprompt to the player's humanoidrootpart. It add the proximitypromp to the player humanoidrootpart but i can not see the proximitypromp. on line 10 i added a line that made it so it cant add a proximitypromp to the player who is holding the handcuffs. But the weird thing is that if i remove that line for some reson it works. but the proximitypromp go on the player body who's is hold the handcuffs witch is not what i want. Can any one help me?

And Here My Code:

local Players = game:GetService("Players")
local Player = Players.LocalPlayer

local AddDetector = Instance.new("ProximityPrompt")

local range = 10

script.Parent.Equipped:Connect(function()
	for i, v in	pairs(game.Workspace:GetChildren()) do
		if v:FindFirstChild("Humanoid") and v ~= Player.Character then
			local vHumanoid = v.Humanoid
			if (Player.Character.HumanoidRootPart.Position - v.Humanoid.Parent.HumanoidRootPart.Position).magnitude < range then
				AddDetector.Parent = vHumanoid.Parent.HumanoidRootPart
				AddDetector.MaxActivationDistance = range
				AddDetector.ActionText = "Arrest"
				AddDetector.HoldDuration = 2
				AddDetector.KeyboardKeyCode = "E"
			end
		end
	end
end)

AddDetector.Triggered:Connect(function()
	
end)

1 comment

0

Maybe the ProximityPrompt is too far from the player holding the handcuff.