CFrame:ToOrientation()

It’s just too hard (CFrame:ToOrientation), it returns a string with numbers and spaces and I’m bad at string manipulation, I want it to return a table or vector3 value. I’ve tried string.sub
Here’s a chunk of code that was hard for me.

  local orientation = CFramee:ToOrientation()
    local y = 0
if type(string.sub(orientation,3,3)) == "number" then
	y = string.sub(orientation,3,3)
	print(y)
end

Thanks for reading

2 Likes

CFrame:ToOrientation does not return a string. It returns three (3) numbers and can be used like this:

local cframe = CFrame.new()
local x, y, z = cframe:ToOrientation()
print(x, y, z)
-- 0 0 0
15 Likes