Spawning a part on an attachment's position

I’m trying to spawn a small part on an attachment’s position but no matter what I try it is always slightly off.

These are the methods I’ve tried:

Method 1: Making the part’s CFrame as the attachment’s world position

I.CFrame = CFrame.new(firePoint.WorldPosition)

Method 2: Setting the part’s position to the attachment’s world position

I.Position = firePoint.WorldPosition

Method 3: Trying to grab the attachment’s world position and multiply it by the actual offset position

I.CFrame = firePoint.CFrame * CFrame.new(firePoint.Position) 

Method 4: Tried using Roblox’s method for finding worldCFrame as seen here

I.CFrame = firePoint.Parent.CFrame * firePoint.CFrame

All methods produced the same result seen here:

No matter what I try the red square is never where the actual attachment is.

Any help? Thx <3 ~APP

1 Like

The actual position is relative to the Parent’s position. You had it right by using:

local cframe = attachment.Parent.CFrame * attachment.CFrame

However, I think your issue could be the animation. Just like the attachment has an offset, animations create an offset that don’t directly affect the cframe of the animated part.

To find this offset you have to find the culprit Motor6D. My guess it’s going to be inside of the character’s right arm.

Once you find it, you can use:

local actualArmCFrame = arm.CFrame * motor6d.Transform

where Transform is the offset that the Motor6D creates.

2 Likes

You’re the best. Cheers!

2 Likes