Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Needing help with brick facing random direction on X axis. Help?

Hello, this is a simple question but I'm bad at movement stuff.

What I'm trying to do is make the brick face a random direction on the X axis but it doesn't change.

I've tried 2 things such as this:

local rot = math.random(0, 360)
	
script.Parent.Orientation = Vector3.new(script.Parent.Position, CFrame.Angles(rot, 0, 0))

And this:

local rot = math.random(0, 360)

script.Parent.CFrame = CFrame.Angles(rot, 0, 0)

But both of them don't seem to be working, can someone help?

1 answer

✓ Accepted answer

You were quite close.

--Orientation
Part.Orientation = Vector3.new(RotX,0,0)

--CFrame
Part.CFrame = CFrame.new(Part.Position) * CFrame.Angles(math.rad(RotX),0,0)

--Or this if you want to add it to the previous rotation
Part.CFrame = Part.CFrame * CFrame.Angles(math.rad(RotX),0,0)

This discussion is preserved as it was. New answers, comments, and votes are closed.