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

How to make a brick rotate around a brick?

Im going to make a hat with effect and I need to make a brick rotate around it. How do i do it? Im not so good at scripting.

1 answer

✓ Accepted answer

Basically, you set the position of the brick to be the part that you want to rotate around, then add an offset multiplied by a rotation.

local hat = -- hat reference
local effect = -- effect reference

local distanceFromHat = 5

while true do
	for i = 1, 360 do
		effect.CFrame = hat.CFrame * CFrame.Angles(0, math.rad(i), 0) * CFrame.new(Vector3.new(distanceFromHat, 0, 0))
		wait()
	end
end

So quick rundown of the math behind it:

The effect is offset 5 units to the right of the hat, but we multiply the current angle i to the hat so the effect rotates along with it. The hat doesn't actually move but that's the math behind it.

It should net you a result like this.

Hope this helps! :)

1 comment

0

Thank you very much! :)

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