Hey, I’ve been looking at some scripts for my fighting game and i’ve been wondering what the best to set a z roatation to 90 in a look vector cframe.
The code currently looks something like this:
local cframe = Character.Head.CFrame + Character.Head.CFrame.LookVector * 10
hitbox.CFrame = cframe * CFrame.Angles(0,0, math.rad(90))
Currently the end result looks something like the image on the left, while the ideal one is the image on the right.
Naturally, I could just choose to use a different bodypart or a different keyframe, but as a coder, I feel the incredible, unexplanable urge to learn how to extract a sepcific angle within a cframe and change it forcefully to my will, instead of doing something that would take 2 minutes.
so as a tldr, how do I take an already made cframe and dissect it, taking out its z rotation, and replacing it with something that will always by 90 no matter the circumstances?
*side note: idk why but the code seems to be working again, and now im wondering why