How to Rotate a part with BodyGyro with CFrame and Vector3

I want to rotate a part with BodyGyro, and be able to change the existing orientation with a new Vector3. For example: BodyGyro.CFrame = +

What I’ve written done so far doesn’t work.

I’ve looked and couldn’t find anything relevant to my issue on the Dev Hub. This is what I have written:

function forwardpitch()
	BodyGyro.CFrame = +, math.rad(0), math.rad(-0.05)))

function backwardpitch()
	BodyGyro.CFrame = +, math.rad(0), math.rad(0.05)))

function leftyaw()
	BodyGyro.CFrame = +, math.rad(0.05), math.rad(0)))

function rightyaw()
	BodyGyro.CFrame = +, math.rad(-0.05), math.rad(0)))

I control the functions with key inputs. In the video, I was pressing WASD, but no result.

And yes, I know the key inputs work fine. I’ve tested them.

And I also changed the vector3 numbers to 15, but still nothing.

Are you looking strictly for a vector3? Usually CFrame.Angles is utilized when rotating CFrame values, for example

part.CFrame = part.CFrame * CFrame.Angles(0,math.rad(90),0)

That would rotate the part 90 degrees on the Y axis and it would allow for you to change the existing orientation with ease without the use of Vector3s.

1 Like