CFrame of a clone not working properly

Hello people who are competent! My issue today is that no matter what part I try to get the CFrame of, the cloned model won’t rotate to it.

Here’s the script:

wait(3)
local Model = game.ReplicatedStorage:WaitForChild("WeaponModels"):WaitForChild("TommyGun"):Clone()
Model.Parent = game.Workspace.StarterCharacter

AttatchmentCFrame = game.Workspace.StarterCharacter["Right Arm"].WeaponAttatchment.CFrame
ModelCFrame = Model:GetPivot()
Model:PivotTo(ModelCFrame * AttatchmentCFrame)


local Motor6D = Instance.new("Motor6D", game.Workspace.StarterCharacter["Right Arm"])
Motor6D.Part0 = game.Workspace.StarterCharacter["Right Arm"]
Motor6D.Part1 = Model.Gun


game.Workspace.StarterCharacter.Humanoid:MoveTo(game.Workspace.Test.Position)

Here is what is happening when I run the script:

And here is an image of what I want to happen:

As you can see, the rotation of the model won’t match the rotation of the attachment, no matter what rotation either are set to. I have also tried other parts, but it would not work with those either.

I have tried Pivoting, changing the PrimaryPart CFrame, and changing the WorldPosition, but nothing has worked.

I know I have like -83 IQ so what I am doing is most likely very obviously wrong, but I can’t find a solution anywhere when I search for it. Help would be appreciated.

When you create a Motor6D or a normal Weld, the Part0 immediately locks to Part1, what I mean by this is that it locks its position so its aligned with Part1’s CFrame, instead of using :PivotTo before adding Motor6D/Weld, Manipulate the C0 and C1 values of the Motor6D.

For info: C0/C1 acts like Attachment’s .Position or .CFrame that it is relative to the part’s position.
Tweak it as much until it shows ur desired output.