How can I get a part to rotate around a point? Say I have a brick 5 units in front of a point, how would I rotate it 180 degrees around the point while maintaining its distance?
CFrame
A simple implementation of CFrame.Angles will do the trick. CFrame.Angles returns a rotation with 3 given axes (X,Y,Z), in radians.
Radians overview
In case you don't know how radians work, I'll provide a quick overview. Radians are basically a different form of measurements for a circle (oppose to degrees). But, they can work the same way. An example of radians you're probably familiar with is Pi (3.14...) which represents half a rotation in radians. Therefore 2*Pi = 360 degrees, which is a full circle in radians (6.28...)
Anyway, with that out of the way, I'll give you an example:
local Point = CFrame.new(0,10,0) -- The point the object will rotate around local Offset = CFrame.new(0,0,10) -- the offset of the part (distance from it) local Object = Instance.new("Part",workspace) Object.Anchored = true while true do -- Each iteration, we're making the Object's CFrame equal to the Point's CFrame, multiplied by the rotational CFrame, then again multiplied by the offset. -- "math.rad" simply converts it's numeric argument to radians. for i = 1,360 do Object.CFrame = Point * CFrame.Angles(0,math.rad(i),0) * Offset wait() end end
Note
I'm not gonna cover the entire CFrame library, so if you're not experienced in it, I suggest this wiki page: http://wiki.roblox.com/index.php?title=CFrame#Constructors
Hope this helped, let me know if you have any questions.