Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Rotation set to 180 but doesnt work?

Asked by 2 years ago
Edited 2 years ago

The rotation that is set to 180 does not work and I don't know why. Can i get help?

local Rotate = 0
local Number = math.random(1,2)
local Block = script.Parent

if(Number == 1) then
    Rotate = 0
else
    Rotate = 180
end

Block.Rotation = Vector3.new(math.rad(Rotate),0,0)
0
it turns but not 180 ohhophophoplikebunny 25 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago

There is no property called "Rotation" on a Part.

Change

Block.Rotation= Vector3.new(math.rad(Rotate),0,0)

to

Block.Orientation = Vector3.new(math.rad(Rotate),0,0)

0
This is incorrect. BasePart DOES have a rotation property, and using orientation WON'T fix it, because orientation is also in DEGREES. Befogs 113 — 2y
Ad
Log in to vote
0
Answered by
Befogs 113
2 years ago

Rotation is "The rotation of the part in degrees for the three axes." The issue here is that you are converting your degrees to radians, but rotation is in degrees. The solution here is to simply remove the radian conversion (math.rad).

Block.Rotation = Vector3.new(Rotate,0,0)

Answer this question