# Part Orbit Around A Radius?

Hello, my problem is I want to have a part orbit around a set radius. I know how to do this sort of. I want to be able to control how many times a second that it orbits around the radius. so if I wanted to have the part orbit around a radius of 10 and I want it to do a complete orbit 360 degrees every 10 seconds how would I do that?

Here is my current code but I cannot figure how to get it so I can choose the amount of time it orbits around it fully (in seconds)

``````local Radius = 10
local Angle = 0

RunService.Heartbeat:Connect(function(DeltaTime)
Part.CFrame = CFrame.new(Radius * math.cos(Angle), 0, Radius * math.sin(Angle)) * CFrame.Angles(0, DeltaTime * math.rad(360) * tick(), 0)
Angle = Angle + math.rad(math.pi * 2)
end)
``````

Can anyone help?

I don’t know what you’re doing here with the angle, really all you have to do is this

``````Angle = math.rad((math.deg(Angle) + DeltaTime * 360 / 10) % 360) -- 10 is the seconds
``````

Of course I converted it into degrees and back.

How would you do it without converting to degrees? I’m making the part orbit a radius while the part is spinning very quickly

``````local OrbitTime = 10
Angle = Angle + math.rad(360 / OrbitTime * DeltaTime)
``````

I guess you would convert 360 degrees into 2pi radians

``````Angle = math.rad((Angle + DeltaTime * 2 * math.pi / 10) % (2 * math.pi))
``````

The modulus prevents the number from getting too high, otherwise just use this

Thanks for the help! And @heII_ish