Help with generating exponential growth list

I want to get 5 items to show up based on the page number and it want it to be base on the equation P(n) = 2^x. The problem at hand is the initial value being 2 instead of 1

Whats Happening Currently:

What I Want

I am stumped

My code ofc:

		local base = 2
		local page = buyables.pagenum.convert.Value
		local rowAmount = Settings["Buyables Per Row"]
		local statamount = base ^ (page * rowAmount - rowAmount)
		
		local Buttons = {}
		
		for i = 1, rowAmount do			
			statamount = statamount * base
			
			--Do stuff with the statamount
		end

pls hgelp me

In that case wouldn’t you just multiply the number of rebirths by 1000 to get the number of coins?

Or are you talking about the number of rebirths? Then you could probably just change base to 1

change

local statamount = base ^ (page * rowAmount - rowAmount)

to

local statamount = 1 * 2 ^ (page * rowAmount - rowAmount-1)

might work, idk since idk what page or rowAmount is

row amount is the amount of items on one page. also that’s redundant as 2 is the base and multiplying by 1 wont do anything.

oh ye multiplying by 1 is useless i forgot

but theres a -1, which makes the base value of the power 0, so statamount would start at 2^0 (which is 1) instead of 2^1 (which is 2)


that seemed to work

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.