Tool welds with other players

  1. The shield weld works but whenever i go near a player or rig, the shield creates a weld for that player too, i am trying to make it only weld only on one player.

2… The shield will weld to other players, and rigs,
Screenshot 2024-07-17 161126
Screenshot 2024-07-17 161146

  1. I tried using clickdetector, but it wouldn’t work.
local handle = script.Parent

handle.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local arm = hit.Parent["Left Arm"]
		local weld = Instance.new("Weld")
		weld.Part0 = arm
		weld.Part1 = handle
		weld.Parent = script.Parent
	end
end)
2 Likes

If you are cloning the shield it is also probably cloning the weld which connects the shield to the original dummy.

Try using :BreakJoints() then creating the weld or checking the descendents of the shield for this weld.

Edit: Nvm I see it’s a weld on touch script you can add a bool value to see if its already welded.

local handle = script.Parent
local alreadyWelded  = false
handle.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and not alreadyWelded  then
		local arm = hit.Parent["Left Arm"]
		local weld = Instance.new("Weld")
		weld.Part0 = arm
		weld.Part1 = handle
		weld.Parent = script.Parent
alreadyWelded = true
	end
end)
2 Likes

I’m assuming this is not a custom-made Tool. If so, you should use Tool.Equipped to weld the shield to the arm, and Tool.Unequipped to free the shield.

local tool = script:FindFirstAncestorWhichIsA("Tool")
local handle = script.Parent
local weld

tool.Equipped:Connect(function()
	local character = tool.Parent
	
	local arm = character["Left Arm"]
	weld = Instance.new("Weld")
	
	weld.Part0 = arm
	weld.Part1 = handle
	weld.Parent = script.Parent
end)

tool.Unequipped:Connect(function()
	weld:Destroy()
end)
2 Likes

Thanks alot, it finally worked

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.