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
10 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 10 years ago

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

sphere = script.Parent --This means that you have to have the script in the sphere part
a = 0
    repeat
        sphere.Rotation = Vector3.new( 0, a, 0) --The second value of vector3 is a,
        wait(.01) -- we wait .01 seconds,
        a = a+1 --a's value increases
    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 — 10y
Ad
Log in to vote
1
Answered by
AxeOfMen 434 Moderation Voter
10 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.

local xDelta = 0.1
local yDelta = 0.1
local zDelta = 0.1
local ball = game.workspace.Ball
local origCFrame = ball.CFrame
local index = 1
while true do
    ball.CFrame = origCFrame  * CFrame.Angles(xDelta * index, yDelta * index, zDelta * index)
    index = index + 1
    wait(0.05)
end
Log in to vote
0
Answered by
Infocus 144
10 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