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?
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 :)
Marked as Duplicate by Goulstem
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?