Hi! Is there any way I can make this code shorter? If i have to make 100 rebirth i ll go crazy:
local Owner = script.Parent.Owner
local CurrentPlr = nil
local CurrentPlrId = 0
local TycoonTeamColor = script.Parent.TeamColor
local cooldown = 0.01
Owner.Changed:Connect(function()
if Owner.Value ~= nil then
repeat
wait(cooldown)
for i, v in pairs(game:GetService("Players"):GetChildren()) do
if v.TeamColor == TycoonTeamColor.Value then
local rebirths = v.leaderstats.Rebirths.Value
local currencybefore = script.Parent.CurrencyBefore
local currencycollect = script.Parent.CurrencyToCollect
while true do
wait(2)
if currencybefore.Value ~= 0 then
if rebirths == 0 then
currencybefore.Value = currencybefore.Value *1
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 1 then
currencybefore.Value = currencybefore.Value *1.2
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 2 then
currencybefore.Value = currencybefore.Value *1.4
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 3 then
currencybefore.Value = currencybefore.Value *1.6
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 4 then
currencybefore.Value = currencybefore.Value *1.8
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 5 then
currencybefore.Value = currencybefore.Value *2
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 6 then
currencybefore.Value = currencybefore.Value *2.2
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 7 then
currencybefore.Value = currencybefore.Value *2.4
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 8 then
currencybefore.Value = currencybefore.Value *2.6
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 9 then
currencybefore.Value = currencybefore.Value *2.8
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 10 then
currencybefore.Value = currencybefore.Value *3
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 11 then
currencybefore.Value = currencybefore.Value *3.2
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 12 then
currencybefore.Value = currencybefore.Value *3.4
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 13 then
currencybefore.Value = currencybefore.Value *3.6
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 14 then
currencybefore.Value = currencybefore.Value *3.8
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 15 then
currencybefore.Value = currencybefore.Value *4
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 16 then
currencybefore.Value = currencybefore.Value *4.2
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 17 then
currencybefore.Value = currencybefore.Value *4.4
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 18 then
currencybefore.Value = currencybefore.Value *4.6
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 19 then
currencybefore.Value = currencybefore.Value *4.8
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
elseif rebirths == 20 then
currencybefore.Value = currencybefore.Value *5
currencycollect.Value += currencybefore.Value
currencybefore.Value = 0
end
end
end
end
end
until Owner.Value == nil
end
end)