Models aren't copying part CFrame

Hello, i would like to make it so every time a player clicks an “attachment(a model)” it’ll go to the weapon of choice and copy the CFrame of it ( i had to use WorldPosition since normal CFrame or Position doesn’t work when I’m copying the “attachment(a model)” to the weapon AttachmentPoints(actual attachments) everything is on a local script. (simple term, i want it to match the weapon CFrame)

i tried to use all sorts of things like moveto, and currently SetPrimaryPartCFrame, i cannot use CFrame or position of the weapon inside of the SetPrimaryPartCFrame since it would teleport to the middle of world (world space i believe the name of it) i guess i have to use ToObjectSpace() but i don’t really know how to plug it in

FindingAttachment:SetPrimaryPartCFrame(CFrame.new(FindWeapon:FindFirstChild(partsAttachment.Name).WorldPosition))
FindingAttachment:SetPrimaryPartCFrame(CFrame.lookAt(FindingAttachment.PrimaryPart.Position, FindWeapon.Position) * CFrame.Angles(math.rad(90), 0, 0))							
1 Like

Each attachment has a position describing how and where it’s placed onto a gun right? You can turn that position into a CFrame so that the position will be relative to the gun and not the world axes. Then when you want to attach the attachment, just multiply the attachment CFrame to the gun’s CFrame and it’ll translate the position relative to the gun’s orientation.

local attachmentOffset = CFrame.new(0, 1.25, 0.8) --just an example; this would be unique to each attachment/gun
FindingAttachment.PrimaryPart.CFrame = FindWeapon.PrimaryPart.CFrame * attachmentOffset
1 Like

oh and one more thing is there a way to make the attachment face the weapon so stuff like this doesn’t happen

When you built the attachments and guns were they all facing the same axis as the “forward” direction? By default -Z is forward in Roblox and everything should be facing that direction by default

1 Like

uhhh i think i did?
i just copied it from the grenade and just moved the attachments around to create the other weapons