WeldConstraint behaving weird on server

I’m trying to weld a part to a character’s HumanoidRootPart by creating both Part and WeldConstraint on the server but for some weird reason the player’s position stops replicating until there are not any parts welded to it.

Here is the video of the problem:

External Media

Here is the server code of the part and weld creation:

local function createHitbox(Player)
	local PlayerCharacter = Player.Character
	local HitboxCFrame = PlayerCharacter.HumanoidRootPart.CFrame*CFrame.new(0,0,-4)
	local HitboxSize = Vector3.new(5,5,6)
	local HitboxName = "NormalPunchHitbox"
	local HitboxShape = Enum.PartType.Block
	local HitboxLifetime = .3
	local HitboxParent = PlayerCharacter
	local HitboxWelded = true
	local WeldPart0 = PlayerCharacter.HumanoidRootPart
	local newHitbox = Instance.new("Part", HitboxParent)
	newHitbox.CFrame = HitboxCFrame
	newHitbox.Size = HitboxSize
	newHitbox.Name = HitboxName
	newHitbox.Shape = HitboxShape
	newHitbox.CanCollide = false
	newHitbox.Anchored = true
	newHitbox.Massless = true
	newHitbox.Transparency = .5
	newHitbox.CastShadow = false
	if HitboxWelded then
		local HitboxWeld = Instance.new("WeldConstraint", newHitbox)
		HitboxWeld.Part0 = WeldPart0
		HitboxWeld.Part1 = newHitbox
		newHitbox.Anchored = false
	end
	game.Debris:AddItem(newHitbox, HitboxLifetime)
end

I can’t believe how easy it was to fix this :stuck_out_tongue_closed_eyes:. I just needed to unanchor the part before creating the weld instance.

1 Like

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