Hitbox always appears somewhere else

Im making a melee combat, and one of the abilities is something like a spin with a sword. I need to create a hitbox every time the player does this ability.
The problem is that the hitbox always appears somewhere else, like shown in the video below:

This is the part of the code where I insert the hitbox part.

local hitbox = Instance.new("Part")
hitbox.Parent = script.Parent
hitbox.Name = "Hitbox"
hitbox.CFrame = script.Parent.Torso.CFrame.Rotation + (script.Parent.Torso.Position + Vector3.new(-4,.5,0)) --I think i did something wrong in this line, but im not sure
hitbox.CanCollide = false
hitbox.Size = Vector3.new(2,1,8)
hitbox.Material = Enum.Material.ForceField
hitbox.BrickColor = BrickColor.new("Bright red")
local weld = Instance.new("WeldConstraint")
weld.Parent = hitbox
weld.Part0 = hitbox
weld.Part1 = hitbox.Parent.Torso
1 Like

Try teleporting the hitbox to the torso then welding maybe

Where do you want the hitbox to be?

I want it in the front of the player’s torso then and spin with the player.

Well you would could use LookVector so script.Parent.Torso.CFrame.LookVector * [how far forward you want it to be] and i think it is a vector 3 so just do

hitbox.CFrame = script.Parent.Torso.CFrame
hitbox.Position += script.Parent.Torso.CFrame.LookVector * 10

1 Like

Thank you, it works perfectly!

hitBox.CFrame = Character:GetPivot() + Character:GetPivot().LookVector * n
Could combine the two operations into one.

1 Like