How to figure out local CFrame coordinates

I just want to find a CFrame 20 studs in front of a player’s HumanoidRootPart, and in the HumanoidRootPart’s forward-facing direction.

Local coordinates would just be CFrame.new(0,0,-20). It sounds like what you really want is to convert local coordinates to global, in which case you can just do:

local globalCFrame = humanoidRootPart.CFrame * CFrame.new(0,0,-20)

If you want to convert that back to local space:

local localCFrame = humanoidRootPart.CFrame:toObjectSpace(globalCFrame)

2 Likes

It worked, thank you!