So i'm trying to make a script that rotates a model, But I don't exactly know how to do so. Does anyone know how to do it?
COMMUNITY QUESTION
How do I make a Model roate with a Script?
1 answer
Well, to do this, you'll want to use SetPrimaryPartCFrame() which is pretty easy to used when you learn it. If you want to rotate the model, you would do this:
workspace.Model:SetPrimaryPartCFrame(workspace.Model.MyPrimaryPart.CFrame * CFrame.Angles(math.rad(15), math.rad(90), math.rad(0)))
--math.rad() turns numbers into radians, incase you didn't know.
Now, if you want to create a spinning part, do this:
game:GetService("RunService").RenderStepped:connect(function()
workspace.Model:SetPrimaryPartCFrame(workspace.Model.MyPrimaryPart.CFrame * CFrame.Angles(math.rad(15), math.rad(90), math.rad(0)))
end
This works by adding to the models rotation every render frame (about 1/60 of a second) instead of just the first time we run the code.
Also, keep in mind that MyPrimaryPart is the name of the model's primary part, which can be set in it's properties tab.
Hope this helps :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Please remember to search before asking non-specific questions.. chances are it has already been asked.
+1 so you don't lose rep when I moderate