Help with Rebirth System

I want people to be able to rebirth after they have a certain amount of coins and a certain level. I have tried many but am not able to get anything. I need help with a script that would will know when a player has reached a certain amount of coins and a certain level then allow them to rebirth with a 1.5x multiplier. But then also it should become harder to rebirth again.

local leader = Instance.new("Folder")
	leader.Name = "leaderstats"
	leader.Parent = player
	local levelz = Instance.new("IntValue")
	levelz.Name = "Level"
	local xpz = Instance.new("NumberValue")
	xpz.Name = "Exp"
	local xpn = Instance.new("IntValue")
	xpn.Name = "ExpNeeded"
	local Coinz = Instance.new("NumberValue")
	Coinz.Name = "Coins"
	local Rebirthz = Instance.new("IntValue")
	Rebirthz.Name = "Rebirth"
1 Like

Hey there, so a rebirth system is actually quite easy. I would make a variable that says:

local rebirthMultiplier or something like that, and set it to 1. Then, you want to add a GUI. You want to make a textbutton inside of that GUI, and put the Text as rebirth. When you press the TextButton, you’re able to get your player’s coins by doing:

BY THE WAY THIS IS A LOCAL SCRIPT INSIDE OF A TEXT BUTTON. Add a remote event to the replicated storage, and call it giveRebirth.

local button = script.Parent
local giveRebirth = game.ReplicatedStorage.giveRebirth

button.MouseButton1Down:Connect(function(player)
      local Coins = player.leaderstats.Coins
      if Coins.Value >= whateverRebirthAmount then
         giveRebirth:FireServer()
      end
end

Now, in your datastore script, add the following:

local giveRebirth = game.ReplicatedStorage.giveRebirth
local rebirthMultiplier = 1

giveRebirth.OnServerEvent:Connect(function(player)
      rebirthMultiplier = rebirthMultiplier + whatever
end

Make sure you have a method on how to give players coins. You would do this in your server script:

coins.Value = coins.Value + (amount*rebirthMultiplier)

That should do it. I don’t expect this all to work, but it’s an idea. Happy coding.

2 Likes