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

How do you make an object spin?

Asked by
xAtom_ik 574 Moderation Voter
10 years ago

Im just really confused. I don't know what makes it spin and how to script it. Can you help please?

3 answers

Log in to vote
2
Answered by
Damo999 182
10 years ago

Well it's pretty simple you can use a for loop if you want the part to spin a certain amount of times or a while loop which would make spin infinitely unless you call a break which would stop it there are other methods of spinning of objects but this is the way that i know how.

--parts name will be brick

brick = script.Parent
for i = 1,100 do
brick.CFrame = brick.CFrame *CFrame.Angles(1,0,0)
wait()
end

--or a while loop

while true do
wait()
brick.CFrame = brick.CFrame *CFrame.Angles(1,0,0)
end

0
Could you please tab your code. modFrost 130 — 10y
0
Sorry about that. Damo999 182 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

Set Anchored to false on the part and then set the RotVelocity property to the desired direction you want the part to rotate.

Log in to vote
-1
Answered by 10 years ago
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0.1,0)
wait(0.01)
end

OR

while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0.05,0.05,0.05)
wait()
end

Answer this question