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

How do I make a sphere spin forever?

Asked by
Hirokai 10
11 years ago

I've tried scripting of how to make a spinning sphere do a forever loop, but there's always something wrong, not sure why. Any help?

3 answers

Log in to vote
0
Answered by 11 years ago

Here's a simple and easy-to understand one:

1sphere = script.Parent --This means that you have to have the script in the sphere part
2a = 0
3    repeat
4        sphere.Rotation = Vector3.new( 0, a, 0) --The second value of vector3 is a,
5        wait(.01) -- we wait .01 seconds,
6        a = a+1 --a's value increases
7    until pigs == 1 --Just make sure you never have pigs' value to 1, and it'll spin forever

Hope this helped!

0
Thank you for your help, this is appreciated! Hirokai 10 — 11y
Ad
Log in to vote
1
Answered by
AxeOfMen 434 Moderation Voter
11 years ago

The following script will cause a ball to spin indefinitely. Modify the xDelta, yDelta and zDelta values to adjust the amount of spin on those axes. If you do not want any spin on the xAxis, for instance, set xDelta to zero.

01local xDelta = 0.1
02local yDelta = 0.1
03local zDelta = 0.1
04local ball = game.workspace.Ball
05local origCFrame = ball.CFrame
06local index = 1
07while true do
08    ball.CFrame = origCFrame  * CFrame.Angles(xDelta * index, yDelta * index, zDelta * index)
09    index = index + 1
10    wait(0.05)
11end
Log in to vote
0
Answered by
Infocus 144
11 years ago

By manipulating the Z axis.

local spinner = script.Parent --Put this script inside a part.

while wait(.03) do

spinner.CFrame = spinner.CFrame * CFrame.Angles(0, 0, .1)

end

Answer this question