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

How do i make Models rotate/turn with a script?

Asked by 9 years ago

I tried using the Rotation property, until i remember Model's don't have a Rotation property, so now i need help?

2 answers

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

You are correct on that note. To Rotate all children of a model, I'd recommend using the GetChildren method.

a = game.Workspace.Model
num = 0
repeat
for i,v in pairs(a) do
    v.Rotation = v.Rotation + .1
end
num = num+1
wait()
until num == 10

The above script will move all the parts in a circular motion until I call it to stop.

Ad
Log in to vote
0
Answered by
Elttob 15
9 years ago

A way I commonly use involves Model:SetIdentityOrientation() and Model:ResetOrientationToIdentity().

First, set the model's PrimaryPart to something inside the model (a Part will work) In this case, I will use part P.

Now we call Model:SetIdentityOrientation().

Now, I set P's Rotation value to a rotation I choose. Note that the model will rotate the other way.

Finally, we call Model:ResetOrientationToIdentity() to rotate the model.

From here you can reset the PrimaryPart value if you wish, if so you should call the Destroy() method on part P.

Answer this question