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:

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

1 answer

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

Forget MoveTo, use SetPrimaryPartCFrame.

local RotationModel = workspace.RotationModel

for i = 1,100 do
    RotationModel:SetPrimaryPartCFrame(RotationModel.CFrame * CFrame.Angles(0, 1, 0)) 
end
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