Rotate part relative to other part, in an circular manner

So what I have in mind is that an part relative to other part, in an circular manner.

See a example below.:

Although my drawings skill aren’t the best, hopefully you could’ve understood.

How would I do this? Is there are built-in an function for this exact same thing?

And yes, I did some search, I wouldn’t say it’s the best I could’ve done, but I tried.
I found the CFrame:fromAxisAngle(Vector3, Degrees) function, but it didn’t seem to work, or the code I’ve used did something wrong. Also, talking about code, here’s what I tried:

local ToRotate = Instance.new('Part')

ToRotate.Anchored = true
ToRotate.CFrame = script.Parent.CFrame + Vector3.new(2,0,2)
ToRotate.Parent = workspace

game:GetService('RunService').Heartbeat:Connect(function()
    ToRotate.CFrame = ToRotate.CFrame  * CFrame.fromAxisAngle(script.Parent.Position, 0.1)
end)

Assuming this script was an child of one of the example parts. (And that only 1 part was there.)

How would I go on this?

I suggest checking out these posts
How to make a part orbit another part - Help and Feedback / Scripting Support - Roblox Developer Forum
Putting an Object in Orbit - Help and Feedback / Scripting Support - Roblox Developer Forum
It should work for your game

2 Likes