So im working on a building system atm, and for rotating parts im currently using 3 keys to turn each XYZ orientation axis, and i realized that this isnt the best way to do it and can be done with just 2 keys, like the roblox studio building keys R and T can rotate a part perfectly by flipping the part either up or to the side.
So ive been trying to do research and figuring out how to do this and i have no clue how to even get this. Would i use orientation and check if the part is rotated in a specific way and then rotate it in a certain direction? or is there something i can use to rotate the part? i dont really know thats why im asking for help.
right now all im doing is
if inp.KeyCode == Enum.KeyCode.R then
if rotx >= 360 then
rotx = 90
else
rotx += 90
end
elseif inp.KeyCode == Enum.KeyCode.T then
if roty >= 360 then
roty = 90
else
roty += 90
end
elseif inp.KeyCode == Enum.KeyCode.Y then
if rotz >= 360 then
rotz = 90
else
rotz += 90
end
end
which is just a simple way to change the orientation of the part, rotx,roty,rotz being the XYZ of the parts orientation axis.
and yes ive tried just using 2 axis like X and Y for orientation and it doesnt work since it doesnt let me turn the part in certain directions.