"Position cannot be assigned" when trying to set attachment CFrame

I’m trying to create a holster system and I have an attribute on a weapon that is a CFrame value. I’m trying to set the CFrame position and orientation of the attachment that is inside the handle of the weapon to whatever the weapon CFrame attribute is. However I get “Position cannot be assigned to” and not sure what I am doing wrong?

local attachment = Instance.new("Attachment")
		attachment.Name = attachmentName
		attachment.Position = Vector3.new(0, 1.1, 0)
		attachment.CFrame.Position = CFrame.new(tool:GetAttribute("HolsterCFrame").Position)
		attachment.CFrame.Orientation = CFrame.new(tool:GetAttribute("HolsterCFrame").Orientation)
		attachment.Parent = handle
1 Like

Seems like this is what you want, does this work? You are disassembling a CFrame and trying to re-assemble it in the same line.

attachment.CFrame = tool:GetAttribute("HolsterCFrame")
2 Likes

Thank you so much! I didn’t realize how simple it actually was!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.