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

Move a part 2 studs towards the left face?

Asked by 4 years ago
Edited 4 years ago

I know this isn't a request site, and I'm supposed to include what I've tried, but I just don't know where to start. I want to move a part to it's left face, so that I can rotate it without having to rescript it for each rotation. I've searched the web and found nothing. How would I do this?

1
what do you mean? iivSnooxy 248 — 4y

3 answers

Log in to vote
1
Answered by
Elyzzia 1294 Moderation Voter
4 years ago

to rotate a part to the left, you can just do this

part.CFrame = part.CFrame * CFrame.Angles(0, math.pi/2, 0) -- pi radians = 180 degrees

if you mean actually baking that rotation into the part, so you don't have to apply it every time you change its CFrame, there's no way to do that within roblox itself

you can either create an entirely new part or export the part and rotate it in a 3d software like blender, then import it back in

if you're really lazy you can weld the part to another part at a 90 degree angle and change the CFrame of the other part, but that's kind of somewhat extremely hacky

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

There's a bunch of free models that do this. Search "Turning Part" on the toolbox. Using Vector3 might also help you.

0
I couldn't find anything from that. MrOinkerzYT 87 — 4y
0
But thanks for trying. MrOinkerzYT 87 — 4y
0
:) iivSnooxy 248 — 4y
Log in to vote
0
Answered by 4 years ago

By the left face, you must mean sideways left?

workspace.Part.CFrame = workspace.Part.CFrame + (workspace.Part.CFrame.RightVector * -2)

to explain it you use -2 because it is the right side so you want to go negative and im not sure if there is a left vector if youre rotating it i would do something like this but i am not sure as of its accuracy

workspace.Part.CFrame = workspace.Part.CFrame * CFrame.Angles(0,math.rad(90),0)

Answer this question