I'm making a level system, and I'm wondering what the formula is used for Fibonacci Progression

So basically I have a level system set-up, but don’t know what the formula for max experience.

I want the level system’s max exp to be like this.

Start at 100 and go up linearly like so. v
100 , 200, 300, 500, 800, 1300, 2100

-- a little more context

xp:GetPropertyChangedSignal("Value"):Connect(function()
	if xp.Value >= maxXP.Value then
		xp.Value = 0
		level.Value += 1
		maxXP.Value *= 1.618034 -- how would I make it go, 100 , 200, 300, 500, 800, 1300, 2100?
        -- max xp starts at 100 by default.
	end
end)

What is the formula used to calculate this?

This is more of a math problem than an actual scripting support, but I don’t know a better place to put this.

1 Like

Here is a great website you could use to find patterns(I’ve inserted the sequence for you):

You could probably use a function to define each level value. Pretty sure this is known as recursion.
local function fibonacci(level)
if level == 1 then
return 0
elseif level == 2 then
return 1
else return fibonacci(level-1) + fibonacci(level-2)
end
end

maxXP.Value = fibonacci(level.Value)*100

The Fibonacci isn’t an arithmetic sequence, because its jump between two numbers is always different.

1 Like