Fe Hat Orbit Script File
-- ModuleScript: HatOrbitController local HatOrbitController = {} function HatOrbitController.startOrbit(hatHandle, targetPart, radius, speed, heightOffset) local angle = 0 local connection
-- Ensure hat is attached to head initially hat.Handle.CFrame = head.CFrame * CFrame.new(0, heightOffset, 0)
connection = game:GetService("RunService").RenderStepped:Connect(orbitUpdate) return connection -- to disconnect later end FE Hat Orbit Script
local y = heightOffset + math.sin(angle * 2) * 0.5 Store hats in a table and assign each a phase offset:
local relativePos = Vector3.new(x, y, z) local newCFrame = head.CFrame + head.CFrame:VectorToWorldSpace(relativePos) FE Hat Orbit Script
[ x = r \cdot \cos(\theta + \textphase) ] [ z = r \cdot \sin(\theta + \textphase) ] or for 3D orbits: [ y = r_y \cdot \sin(\textvertical angle) ]
angle = angle + speed * dt if angle > math.pi * 2 then angle = angle - math.pi * 2 end FE Hat Orbit Script
-- Apply new CFrame to hat handle hat.Handle.CFrame = newCFrame end
local angle = startAngle local lastUpdate = os.clock()
local function orbitUpdate() angle = angle + speed * tick() local x = math.cos(angle) * radius local z = math.sin(angle) * radius local relativeCF = CFrame.new(x, heightOffset, z) hatHandle.CFrame = targetPart.CFrame * relativeCF end

