How to make a max amount of Rebirths

Hey! ive been a scripter for a while and ive gotten used to it, though. i still cant seem to find the code required to make a max amount of Rebirths/Upgrades, you see, im making a Soul Ops game. Soul Ops Games are games based on UNDERTALE. here is an explanation shortly: you have to protect 6 SOULS, in a tube. And you have to upgrade tiers and use coins to unlock characters and get to the end of all the waves. Anyways, im trying to make the max amount of tier upgrades 9, here are the scripts i use:

script.AddPoint.OnServerEvent:connect(function(plr)
    plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value +1 +plr.leaderstats.Tiers.Value
	if plr.DoublePass.Value == true then
		plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value +1 +plr.leaderstats.Tiers.Value
	end
end)
script.Rebirth.OnServerEvent:connect(function(plr)
	plr.leaderstats.Tiers.Value = plr.leaderstats.Tiers.Value +1
	plr.leaderstats.Coins.Value = 0
end)
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
	if (plr.leaderstats.Tiers.Value*0) +1250 <= plr.leaderstats.Coins.Value then
		workspace.Events.Rebirth:FireServer()
	end
end)
local plr = game.Players.LocalPlayer
while wait() do
	if (plr.leaderstats.Tiers.Value*0)+1250 <= plr.leaderstats.Coins.Value then
		script.Parent.Text = "1 Tier Required: BUY"
	else
		script.Parent.Text = "1 Tier Requires: ".. (plr.leaderstats.Tiers.Value*0) +1250 - plr.leaderstats.Coins.Value
	end
end

if you can help, il appreciate it. Thanks!

2 Likes

Can’t you just add this line?

script.Rebirth.OnServerEvent:connect(function(plr)
    if plr.leaderstats.Tiers.Value < 9 then 
    	plr.leaderstats.Tiers.Value += 1    -- it's the same as adding 1 to the same variable
	    plr.leaderstats.Coins.Value = 0
    end
end)
1 Like

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