How do I get this direction?

How do I shoot in the direction that the barrel attachment is facing??

function eFire(barrelAttachment)

	if Tool.Parent:IsA("Backpack") then return end
	
	local origin = barrelAttachment.WorldPosition
	local direction = (origin - origin).Unit
	
	if PIERCE_DEMO then
		CastBehavior.CanPierceFunction = CanRayPierce
	end
	
	local simBullet = Caster:Fire(origin, direction, BULLET_SPEED, CastBehavior)
	
	
	
	PlayFireSound()
end

^^^ This code doesn’t work. It’s what I tried to do, I just want to get the direction of the attachment! ^^^

direction = barrelAttachment.CFrame.LookVector * distance
Also you are doing origin - origin which will always be (0, 0, 0)

Just shoots straight up.

character limit

Is ‘barrel attachment’ an attachment or just a part?

An attachment.

character limit

Are you sure that the barrel has it’s faced configured the right way? LookVector should return a Unit Vector shooting out of the Front face

I had it rotated up, fixed it but uh…