TYCOON
Rebirth System
Paste as a Script inside a rebirth button. Paying the rising cost clears Cash and UpgradeLevel, then adds a permanent Rebirths multiplier.
-- Paste as a Script inside a rebirth button.
local Players = game:GetService("Players")
local BASE_COST = 1000
local GROWTH = 2
local button = script.Parent
if not button or not button:IsA("BasePart") then
return
end
local function getCash(player: Player): IntValue?
local leaderstats = player:FindFirstChild("leaderstats")
local cash = leaderstats and leaderstats:FindFirstChild("Cash")
if cash and cash:IsA("IntValue") then
return cash
end
return nil
end
button.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
local cash = player and getCash(player)
if not player or not cash then
return
end
local rebirths = player:GetAttribute("Rebirths") or 0
local cost = math.floor(BASE_COST * (GROWTH ^ rebirths))
if cash.Value < cost then
return
end
cash.Value = 0
player:SetAttribute("UpgradeLevel", 0)
player:SetAttribute("Rebirths", rebirths + 1)
end)