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

How would I make a model rotate around a part?

Asked by 8 years ago

What I mean is how would I rotate a model as a whole while maintaining the relativity to everything else in the model, like in studio? I think you have to set the primary part and you can use moveto to move things like that, but how would you do rotation? I tried this:

1for i = 1,100 do
2for i,v in pairs (game.Workspace.Rotationmodel:GetChildren()) do
3v.Part.Rotation.Y = v.Part.Rotation.Y + 1
4end
5 end

1 answer

Log in to vote
2
Answered by
funyun 958 Moderation Voter
8 years ago

Forget MoveTo, use SetPrimaryPartCFrame.

1local RotationModel = workspace.RotationModel
2 
3for i = 1,100 do
4    RotationModel:SetPrimaryPartCFrame(RotationModel.CFrame * CFrame.Angles(0, 1, 0))
5end
0
Thanks UltChowsk 85 — 8y
0
CFrame is not a valid member of Model Is the error I am getting UltChowsk 85 — 8y
1
Nevermind, I fixed it, you forgot to put PrimaryPart after the RotationModel in the parentheses. UltChowsk 85 — 8y
Ad

Answer this question