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