How to let something go faster every 10 sec

Hi there so im creating a spinning object for a minigame, so my goal is that it goes faster every 10 seconds.

So what i want to achieve that the rotation (a) goes +1 every 10 seconds this means the object will spin 1 pixel faster. How would i be able to achieve this?


sphere = script.Parent
a = 0
while true do
	sphere.Rotation = Vector3.new(0,a,0)
	wait(.01)
	a = a+2
end

1 Like
local startSpeed = 1
local acceleration = 1

local speed = startSpeed
local t = tick()
while wait() do
   local delta = tick() - t
   t = tick()

   sphere.CFrame *= CFrame.Angles(0, math.pi * 2 * delta * speed, 0)
   speed += acceleration * delta
end

You can also just use physical constraints such as a CylindricalConstraint, since you can make them into a spinning motor under their properties. To change the speed, you would only have to modify the rotation speed value of the constraint.

local sphere = script.Parent
local a = 0
local multiplier = 1 
task.spawn(function()  -- creates a separate thread
    while task.wait(10) do -- replace 10 with the interval after which the speed is to be increased
        multiplier += 1 -- change 1 to the increment to the multiplier
    end
end)
while true do
	sphere.Rotation = Vector3.new(0,a,0)
	task.wait(.01)
	a = a + (2 * multiplier) -- multiplies 2 by the multiplier before adding into a to fasten rotation
end

I think the * should be a +, as i want it to go +1 every 10sec

Yeah you can do that.

a = a + (2 + multiplier)

I have a question. What is the point of the task.spawn(function() statement as it is used in the script that you have created? I am curious.