How To Make a Simulator Rebirth (MATH)

Hello developers,

I am trying to make a rebirth system that I have thought out in my head. I want the price to increase like this:
1 rebirth * starting amount (5,000,000) = 5,000,000
2 rebirths * the required amount for the first rebirth (5,000,000) = 10,000,000
3 rebirths * the required amount for the second rebirth (10,000,000) = 30,000,000
and so on.
I’m having trouble coming up with an equation that matches this. Please reply if you know how to do this.

1 Like

It seems as though you’ve already done the math. If I’m understanding you correctly:

function rebirthMath(currentAmount, rebirths)
  return currentAmount*rebirths
end
1 Like

So I how would I get current amount?

1 Like

You could use a module script to hold the value, which is set to the starting amount when the player joins the game. The value could then be updated by the function I specified when the player rebirths. e.g:

local moduleScript = require(someModulePathway)
local currentValueTable = moduleScript.someModulePathway
local currentValue = currentValueTable["currentValue"]

---an event that triggers the rebirth

currentValueTable["currentValue"] = rebirthMath(currentValue, rebirths)
1 Like

Nevermind, Figured it out.
local currentAmount = 5000000
for i = 1, profile.Data.Rebirths, 1 do
currentAmount = rebirthMath(currentAmount, i)
end;

1 Like

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