local Size = 5 local StartX,StartY = 325,200 local function Fibonacci(N) if N < 0 then error("Fibonacci infinitely recurses with a negative number") end if N == 0 then return 0 end if N == 1 then return 1 end return Fibonacci(N-1) + Fibonacci(N-2) end local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "FibonacciSpiral" ScreenGui.Parent = game.StarterGui local ClockwiseTurn = 1 local function DrawCurve(PosX,PosY,Fib,Rotation) local Frame = Instance.new("ImageLabel") Frame.Size = UDim2.new(0,Fib*Size,0,Fib*Size) Frame.Position = UDim2.new(0,-Size*PosX + StartX,0,-Size*PosY + StartY) Frame.BackgroundTransparency = 1 Frame.Image = "rbxassetid://338513872" Frame.Rotation = Rotation Frame.Parent = ScreenGui end --Code for box placement (C#): http://stackoverflow.com/questions/18120908/fibonacci-boxes local Left,Right,Top,Bottom = 0,1,0,0 for i = 1, 10 do local Fib = Fibonacci(i) if ClockwiseTurn == 1 then DrawCurve(Right,Bottom + Fib,Fib,90) Bottom = Bottom + Fib elseif ClockwiseTurn == 2 then DrawCurve(Right + Fib,Bottom,Fib,0) Right = Right + Fib elseif ClockwiseTurn == 3 then DrawCurve(Right,Top,Fib,-90) Top = Top - Fib elseif ClockwiseTurn == 4 then DrawCurve(Left,Bottom,Fib,-180) Left = Left - Fib end ClockwiseTurn = ClockwiseTurn + 1 if ClockwiseTurn > 4 then ClockwiseTurn = 1 end end