How to change the rotation of an object while the Cframe is interrupted

i may have not been that clear in the caption what i meant is

i have an another script that is assigning the object Cframe to an another object cframe every half a second. but all i want is that when the player presses R the object rotation adds 5 to the x axis,

i want it like this

while wait(0.0001) do -- ignore the little mistakes its just an example

object.CFrame = object2.CFrame

uis.inputbegan:connect(function(key)

if key.keycode == enum.keycode.R then

object.Orientation += vector3.new(0,0,5)-- keep in mind this will not effect the orientation because the cframe is interrupted by the lines up but i want it to add 5 while applying the other object's CFrame

end

end)


end

You Multiply the CFrame with another CFrame

obj.CFrame = object.CFrame * newCFrame
-- this can be done with multiple CFrames as well

Keep in mind, Rotations with CFrame are mesured in Radians, not Degrees.

2 Likes

been 3-4 years of me scripting and yet i dont understand Cframes ill try your method

sorry for the late response so can i do this?

obj.CFrame = obj.CFrame * CFrame.new(0,math.deg(5),0)

You could, but you are using the incorrect function to rotate an Object, its supposed to be CFrame.Angles (Alternatively CFrame.fromEulerAnglesXYZ), not CFrame.new

You are also using math.deg which converts radians into Degrees, use math.rad which converts degrees into radians.