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

How do I make a model rotate like a fan?

Asked by
Lualaxy 78
6 years ago
Edited 6 years ago

Hello! I was wondering how I could make an object rotate. But not only that but how do I set the speed aswell. If anyone would have a solution that would be perfect, since I have no clue where to start or where to end :)

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You do not have a simple rotate command, also rotating a model is not the best way to do what you want, you should union the parts you want to rotate first.

To rotate them change the CFrame, not the Vector3 orientation as it might teleport ontop.

CFrame.new(Vector3 pos, Vector3 lookAt)

Or use another way, just use cframe xD

To keep rotating it use a loop

local part = script.Parent
n = 0

repeat
    wait(0.2)
    if n <= 360 then
        n = n + 1
    end
    local rot = Vector3.new(math.rad(part.Orientation.X),math.rad(part.Orientation.Y),math.rad(part.Orientation.Z))
    part.CFrame = CFrame.Angles(math.rad(part.Orientation.X),math.rad(n),math.rad(part.Orientation.Z))
until false

I used CFrame.Angles in the example that looks like to work better for me, you can see how it works for you though, you can also use tweens.

0
Okay I'll try. Lualaxy 78 — 6y
0
Wait a sec, I'll make a simple example script xD User#20388 0 — 6y
Ad

Answer this question