Hitbox(Part) does not weld to the Head how to fix?

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

  1. What do you want to achieve? I want to weld my hitbox to the head of every character

  2. What is the issue? Hitbox(Part) does not weld to the Head. the problem is in line 18 but I dont get an errorcode

  3. What solutions have you tried so far? I put in a wait(4) to make sure that the head is loaded and I searched for the head with :WaitForChild()

the script is in serverscriptservice

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local PrimaryPart = character.PrimaryPart
		local Head = character:WaitForChild("Head")
		local Hitbox = Instance.new("Part",character)
		local HeadHitbox = Instance.new("Part",character)
		local Headweld = Instance.new("Weld",HeadHitbox)
		local Hitweld = Instance.new("Weld",Hitbox)
		
		Hitbox.Name = "BodyHitbox"
		HeadHitbox.Name = "HeadHitbox"
		Hitbox.Size = PrimaryPart.Size*1.5
		HeadHitbox.Size = Head.Size*1.5
		HeadHitbox.Position = Head.Position
		Hitbox.Position = PrimaryPart.Position	
		Hitweld.Part0 = Hitbox	
		Hitweld.Part1 = PrimaryPart	
		Headweld.Part0 = Head
		Headweld.Part1 = HeadHitbox
	end)
end)

if I put the players head manually in weld.Part0 then it works but it doesnt work in the script

The code you provided seems to work perfectly fine for me. Both parts get attached as they should. If it still doesn’t work for you, try changing the Weld into a WeldConstraint and see if that works.

Why is the hitWeld part0 is hitbox and part1 is character primarypart?

Aleight I try it then and watch if it was to problem