CFrame not being recognised in code properly

In this script, I’m trying to use a part’s CFrame Z value, but it seems to be inaccurate; it always prints 0 instead of whatever value is shown in the properties panel.

block.CFrame = CFrame.new(floor, char.HumanoidRootPart.Position) * CFrame.Angles(0,math.pi,0)
print(block.CFrame)

(floor is a vector 3)

Output:


Properties panel:
image

Am I doing something wrong? Printing the block’s rotation value works, but not its CFrame.

2 Likes

could you explain a bit more into detail what you are trying to achieve?

I just need to use the CFrame of the block later on, but the script doesn’t seem to be recognising it properly; as shown above, it prints out a completely different CFrame to its properties.

try making a new cframe using the block’s Rotation and position.

Example:
CFrame.new(block.Position) * CFrame.angles(Rotation)

I’m not sure, but I know that some Properties don’t update in the Properties window until you click another item then click back on the item you want to read.

Those CFrame values are correct, read the documentation: CFrame | Documentation - Roblox Creator Hub

The rotational component is most likely what you’re getting confused about.

1 Like