Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make an object spin around another object?

I want to make a sort of space hologram that includes our solar system and spinning planets. How would I be able to do this? I have all the planets laid out. I want them to spin around the center (Sun).

1 answer

Um. This is actually really simple but it depends. Laying them out is easy correct? But this is what I would do.

local part1 = sun
local part2 = world

while true do
	wait()
	for i = 1,360 do
		part2.CFrame = part1.CFrame
					 * CFrame.new(0,0,5)
					* CFrame.Angles(0,math.rad(i),0)
	end
end

So what happens is, you put the world's cframe relative to the postion of the sun. This just makes it go in circles 5 studs away from the sun. I'm thinking of the top of my head so I'm not sure if it will orbit the sun or just spin in circles. It's one or the other.

This discussion is preserved as it was. New answers, comments, and votes are closed.