Make part go in cirlce doesn't work

  1. What do you want to achieve?
    The part to go in a circle correctly

  2. What is the issue?
    The part goes to exactly origin (0,0,0) and goes in a circle there (my script never tells it to intentionally)

  3. What solutions have you tried so far?
    There’s not much info on doing things like this given by ROBLOX.

task.wait(5)

local degree = 0
while task.wait(0.01) do
	degree += 1
	
	local x = math.cos(math.rad(degree))
	local y = math.sin(math.rad(degree))
	local z = 1
	
	workspace.Planet.Position = Vector3.new(x, y, z)
end
task.wait(5)

local degree = 0
while task.wait(0.01) do
	degree += 1
	
	local x = math.cos(math.rad(degree))
	local y = math.sin(math.rad(degree))
	local z = 1
	
	workspace.Planet.Position += Vector3.new(x, y, z) --// Changed = to +=
end
1 Like

Maybe This help

1 Like

You need to multiply it within a range

local range = 10
while task.wait(0.01) do
	local now = os.clock()

	local x = math.cos(now) * range
	local y = math.sin(now) * range
	local z = 1
	
	workspace.Planet.Position = Vector3.new(x, y, z)
end
1 Like

The script is setting the planet’s position to a completely new position instead of adding on to the original position.
What you would have to do is save the planet’s position in a variable before hand in this case.

task.wait(5)

local OriginalPosition = workspace.Planet.Position
local degree = 0
while task.wait(0.01) do
	degree += 1
	
	local x = math.cos(math.rad(degree))
	local y = math.sin(math.rad(degree))
	local z = 1
	
	workspace.Planet.Position = OriginalPosition + Vector3.new(x, y, z)
end
1 Like