Parts not positioning correctly when trying to make it move forward

So, I have a script that is supposed to move the sword to the correct spot. Model.Pos is an attachment object which stores the position and rotation offsets of the weapon to position it correctly.

Here is my code that is supposed to be positioning the object correctly:

-- Parent the model
		local Handle = User.Handle
		Model.Anchored = true
		
		-- Position the model
		Model.CFrame = Handle.CFrame
		Model.Position += Model.CFrame.LookVector * Model.Pos.Position
		
		-- Rotate the model the model
		Model.CFrame = Model.CFrame * CFrame.Angles(
			math.rad(Model.Pos.Orientation.X),
			math.rad(Model.Pos.Orientation.Y),
			math.rad(Model.Pos.Orientation.Z)
		)
		
		-- Weld the model
		Model.Anchored = false
		local Constraint = Model:FindFirstChild("Constraint")
		Constraint.Part1 = Handle
		
		-- Parent the model
		Model.Parent = Handle

The rotation part is fine, but the positioning part isn’t. I am trying to make it position a sword correctly. Here are two images that show the problem.

Rotated at a degree dividable by 180:

Rotated at a degree not perpendicular to a 180 degree:

Sorry for bad wording.

Thanks!

1 Like

So, I found the issue. I even found a fix for it. The problem is: What happens when the movement offset is (0, 0, 2) and the LookVector is (1, 0, 0)? They cancel out because of the 0s. So I just need to fix this by multiplying the LookVector by Offset.Z.

2 Likes