Odd movement when welding a hitbox part to the humanoidrootpart

Hey, developers! I wanted to weld a hitbox part the humanoidrootpart of a humanoid. CanCollide is false. However, when I try to do this, my character starts to move very wierdly. Here is my script. I’m also implementing an animation, but that works perfectly fine, so please ignore that:

local animationRemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("StartThrowAnim")

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		
		-- Welds a hitbox to the character
		local hitbox = game.ServerStorage:WaitForChild("Hitbox"):Clone()
		hitbox.Parent = char
		local hitboxWeld = Instance.new("WeldConstraint")
		hitboxWeld.Parent = workspace
		hitboxWeld.Part0 = char:WaitForChild("HumanoidRootPart")
		hitboxWeld.Part1 = hitbox
		
		-- Adds a click detector to the hitbox
		local clickDetector = Instance.new("ClickDetector")
		clickDetector.Parent = char:WaitForChild('Hitbox')
		clickDetector.MaxActivationDistance = 20

		clickDetector.MouseClick:Connect(function(playerWhoClicked) -- Welds player to hand when person is clicked
			animationRemoteEvent:FireClient()
			local weld = Instance.new("WeldConstraint")
			weld.Parent = workspace
			weld.Part0 = playerWhoClicked.Character.LeftHand
			weld.Part1 = char.HumanoidRootPart
			
			wait(0.2)
			local yeet = Instance.new("BodyVelocity")
			yeet.Parent = char.HumanoidRootPart
			yeet.Velocity = playerWhoClicked.Char.HumanoidRootPart.CFrame.LookVector
			yeet.MaxForce = Vector3.new(200, 200, 200)
			
		end)
	end)
end)

local avatar = workspace:WaitForChild("dodle120")
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = avatar:WaitForChild('Hitbox')
clickDetector.MaxActivationDistance = 20

clickDetector.MouseClick:Connect(function(playerWhoClicked) -- Welds player to hand when person is clicked
	animationRemoteEvent:FireClient(playerWhoClicked)
	local weld = Instance.new("WeldConstraint")
	weld.Parent = workspace
	weld.Part0 = playerWhoClicked.Character.LeftHand
	weld.Part1 = avatar.HumanoidRootPart

	wait(0.2)
	weld:Destroy()
	local yeet = Instance.new("BodyVelocity")
	yeet.Parent = avatar.HumanoidRootPart
	yeet.Velocity = playerWhoClicked.Character.HumanoidRootPart.CFrame.LookVector
	yeet.MaxForce = Vector3.new(200, 200, 200)

end)

Here’s a video to demonstrate:

robloxapp-20210616-2046443.wmv (2.6 MB)

I repeated the welding just for testing purposes with a dummy since I don’t want to start up a server every time I want to test this. If anyone knows the answer to this problem, I would appreciate it. Thanks!

1 Like

Try toggling on the Massless property for hitbox part.

2 Likes
hitbox.Massless = true
1 Like

Hey! Apologies for the late reply. My Studio wasn’t running and I’ve been busy. I just tested out your solution and it worked! Thanks a bunch.