My hitbox is not connecting to my actual character

Currently I am remaking my own combat with my knowledge, just because I like making combats for fun, and the current issue I have at the moment, is that the hitbox is simply not connecting to the HumanoidRootPart.

Here’s the script

-- \\ Script-Related Variables // --

local Animation = script.Animations

local Meshes = script.Meshes

-- \\ Get-Service Variables // --

local Debris = game:GetService("Debris")

local CombatHandler = {}


function CombatHandler.CombatStarted(Player, Character, Humrp, Count)
	
	local Character = Player.Character
	local Hum = Character.Humanoid
	
	local Folder = Instance.new("Folder")
	Folder.Name = Player.Name.."Folder"
	Folder.Parent = workspace
	Debris:AddItem(Folder, 0.25)
	
	local Hitbox = Meshes.Hitbox:Clone()
	Hitbox.Parent = Folder
	Hitbox.CFrame = Humrp * CFrame.new(0,0,-2)
	
	local Weld = Instance.new("ManualWeld")
	Weld.Part0 = Hitbox
	Weld.Part1 = Humrp
	Weld.C0 = Weld.Part0.CFrame:ToObjectSpace(Weld.Part1.CFrame)
	Weld.Parent = Weld.Part0


	local pos1 = Hitbox.Position - (Hitbox.Size/2)
	local pos2 = Hitbox.Position + (Hitbox.Size/2)
	local Re3 = Region3.new(pos1, pos2)

	local Blacklist = OverlapParams.new()
	Blacklist.FilterType = Enum.RaycastFilterType.Blacklist
	Blacklist.FilterDescendantsInstances = {Hitbox, Character}	
	
	local HBFinder = workspace:GetPartBoundsInBox(Re3.CFrame, Re3.Size, Blacklist)
	Debris:AddItem(Hitbox, 0.3)
	for i, parts in pairs (HBFinder) do
		local enemyChar = parts.Parent
		local enemyHumanoid = parts.Parent.Humanoid
		
		local M1Stun = Instance.new("BoolValue")
		M1Stun.Name = "Stun"
		M1Stun.Parent = enemyHumanoid
		
		local enemyRootPart = parts.Parent.HumanoidRootPart
		
		if enemyHumanoid:FindFirstChild("Stun") then return end
		
		enemyHumanoid:TakeDamage(5)
		
		Debris:AddItem(M1Stun, 0.25)
		Count += 1
		if Count == 4 then
			local BV = Instance.new("BodyVelocity", parts.Parent.HumanoidRootPart)
			BV.MaxForce = Vector3.new(22500, 22500, 22500)
			BV.P = 33300
			BV.Velocity = -parts.Parent.HumanoidRootPart.CFrame.LookVector * 40
			Debris:AddItem(BV, 0.25)
			Count = 1
		end
		
		break
	end
end

return CombatHandler

Try this

Hitbox.CFrame = Humrp.CFrame * CFranem.new(0,0,-2)
2 Likes
CFrame.new(0,0,-2)

You mean.