I have never used CFrame, and I have tried multiple ways of doing this and I just can not figure it out, here is what I have
local model = game.workspace.smallStatue function rotateMod() for i=1,360 do model.CFrame = model.CFrame * CFrame.fromEulerAnglesXYZ(0,0,0) end end rotateMod()
Sorry, I'm completely clueless. Thanks.
You're on the right track, but there are a few issues.
1) Models don't have a CFrame
property, so you're going to have to take advantage of the GetPrimaryPartCFrame
and SetPrimaryPartCFrame
functions. These functions get and set the CFrame of the model according to the model's PrimaryPart location. Note: you will have to set the PrimaryPart property prior to using either of these functions
2) In order to effectively rotate a CFrame, you should use the CFrame.Angles
constructor. Remember to put in radians as arguments aswell, using the math.rad
function.
3) "Workspace" is case sensitive if indexing it from the game, so line 1 needs to be fixed.
4) Your for loop needs a wait
in it, otherwise this will happen instantaneously.
local model = workspace.smallStatue function rotateMod() model.PrimaryPart = model:GetChildren()[1] --Set the PrimaryPart for i = 1,360 do local cf = model:GetPrimaryPartCFrame() --Get the current CFrame --Set the CFrame relative to current cf, rotated by 1 radian model:SetPrimaryPartCFrame(cf * CFrame.Angles(math.rad(1),0,0)) wait() --yield end end rotateMod()