I can't figure out how to rotate a part 90 degree after clicked on.
1 | local topCenter = script.parent |
2 | local clickdetector = game.Workspace.Wedge.ClickDetector |
3 |
4 | clickdetector.MouseClick:Connect( function () |
5 | topCenter.Orientation = Vector 3. new(- 90 , 0 , 0 ) |
6 | end ) |
I'm using this code but it only rotates the part once.
I want to be able to rotate it multiple times.
You need to add # of degrees to the number that the x axis is orientated to.
01 | local turnNum = 0 -- this gets manipulated |
02 | local turnAmount = - 90 -- change to whatever |
03 | local topCenter = script.parent |
04 | local clickdetector = game.Workspace.Wedge.ClickDetector |
05 |
06 | clickdetector.MouseClick:Connect( function () |
07 | turnNum = turnNum + turnAmount |
08 | topCenter.Orientation = Vector 3. new(turnNum, 0 , 0 ) |
09 | print (topCenter.Orientation) -- remove if desired |
10 | end ) |