Issue with welding tool to player

I’m trying to weld the tool to the player hand so that whenever an animation happens, the gun actually follows the hand. I’m currently having an issue where it causes the player hand to go up in the air with the gun , here’s the code in a server script (event fired when player equips tool)

tool.Weld.OnServerEvent:Connect(function(player, type_)
	if type_ == "weld" then
		local weldConst = Instance.new("WeldConstraint")
		weldConst.Name = "PositionWeld"
		weldConst.Parent = tool
		weldConst.Part0 = tool.Handle
		weldConst.Part1 = player.Character.LeftLowerArm
	end
end)

Part0 is the part that Part1 will be attached to, in your code you have part0 set to the handle, meaning that the player’s character is attached to the handle instead of vise versa. I’d also recommend that you use a Weld instead of a WeldConstraint, with a C0 / C1 CFrame offset.

2 Likes
  • Since it’s a tool, you can just overwrite the normal tool-equip animation with an action animation or just use Humanoid:GetPlayingAnimationTracks() and stop the animation or rewrite the default roblox-animate script.

Also, any part that is called, “Handle” will be default welded as noted.

1 Like