How do I position a part at an attachment position?

Hey,
so I want to position a part at a certain position and orientate it using a script. I’m using an attachment (parented to a different part) which should indicate my desired position and orientation for the part to be positioned.
Until now I haven’t checked how to orientate it using the attachment but I already tried to set the position with:

part.CFrame = attachment.WorldCFrame

or

part.Position = attachment.WorldPosition

The problem: Every time I position the part it uses the middle of the part for the position (so after positioning it the attachment would be in the middle of the part).
Here some pictures for clarification:
(what I get)


(what I want)

You’d need to offset it’s position based on the size of the part. Here’s some code I did to achieve this:

local attachment = Instance.new("Attachment")
attachment.Name = "TestAttachment"
attachment.Position = Vector3.new(0, 35, 0)
attachment.Parent = workspace.Terrain

local part = Instance.new("Part")
part.Anchored = true
part.CastShadow = false
part.CFrame = attachment.WorldCFrame * CFrame.new(part.Size.X / 2, 0, 0)
part.Parent = workspace

The result of this being ran: