How would you offset a part based off the position of another part

So, I am making a system for throwing grenades in my game. However, I am unsure of how to get the offset to work, as if you just place the grenade higher, you can’t throw it through doors and windows, but if you offset it on the X or Z axis it will be behind or to the side of the player if you are facing the wrong way.
Please help.
Current code:

grenade.CenterPart.Position = player.Character.HumanoidRootPart.Position +,0,0)

The reason this is happening is because Position is not relative to the part you’re moving. Think of the baseplate as a giant x, y, z axis, and that you’re moving the part along that. No matter which orientation you have it’s going to follow the same axis.

To fix this, you’ll have to use CFrame which will move the part on it’s own axis. The Z-axis will move the part forwards or backwards, X-axis will move the part left or right, and the Y-axis will move the part up and down.

grenade.CenterPart.CFrame = player.Character.HumanoidRootPart.CFrame *,0,0) --2 studs left
1 Like