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

Spinning a model?

Asked by 9 years ago

I tried too let spinning a model but it won't work. whats wrong?

while true do
    script.Parent:SetPrimaryPartCFrame(ClassName("Model").CFrame * CFrame.fromEulerAnglesXYZ(0,0.01,0)) 
    wait(0.001) -- time for add more lines
end

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

To spin a model, you have to use the SetPrimaryPartCFrame function. This allows you to set the CFrame of the model. If you use this function along with the GetPRimaryPartCFrame function, then you can multiply that value by an angular offset.

--Define your model
local model = workspace.Model
--Define your offset
local offset = CFrame.Angles(math.rad(5),0,0)

while wait() do
    --Set the CFrame
    model:SetPrimaryPartCFrame(
        --Get current CFrame
        model:GetPrimaryPartCFrame()
        --Multiply by offset.
        * offset
    )
end
Ad

Answer this question