How to make a rebirth system?

I wanted to make a rebirth system that if you buy the rebirths is takes the base rebirth price and does this:

baseClicks * Rebirths * .5

I don’t know how to make this and need a little help because i do not know how i can get started

2 Likes

I’m guessing you are using the above formula to work out when you can rebirth, correct me if I am wrong.

There is no 1 fits all method for this since this varies completely from game to game but what I can give you is some help like you have asked for,

  1. Detect when the player has enough to rebirth, this could be any value that you yourself have set.

  2. When the rebirth button is clicked, send a message to the server which verifies if the player can rebirth or not.

  3. All you have to do now is substitute the values in your formula and you can go from there.

I may have misunderstood your question so let me know if you need anymore help.

1 Like

I can explain a bit better again: i wanted to make a simple gui rebirth system so that it adds 1 rebirth every 100 clicks but i also want the price to got up for the rebirths in this way: Price x Rebirths x .5. but i dont know how i can make it work since i have never made a rebirth system and example code would help alot!

1 Like

Have you already got a datastore/rebirth value set up?

Here’s what you’d need for something like this,

  • A Datastore set-up.
  • A table for the player that indicates how many rebirths they’ve had, and the how much you want the next rebirth to up by.
  • The price of the initial rebirth.

After you’ve set everything up, you need to create a system that’ll be notified when they’ve reached their rebirth state, and rebirth them if they wish.

Since you haven’t provided any coding, I’m not sure what you already have set-up… if anything.

1 Like

Not trying to be that guy, but the rules when you make a post are very clear. “Do not expect people to write full chunks of code for you.” You really should do some research, and at least have the baseline idea so you can be pushed in the right direction. I know you said “example code would be nice”, does that mean you haven’t even attempted to make it yet? You probably should.

4 Likes

i am sorry for doing that, all tho i didnt ask or whole chunck of code because im clearly asking for example code i can start off with because i do not know what to do! I also got a working code/made a working code that has some issues but yea

yes, and i also have a code for the system and its working, but im having issues with it: it doesnt want to update the text on one click. instead it updates the text on 2 clicks. here is the localscript code im using:

local rep = game:GetService("ReplicatedStorage")

local config = script.Parent.Config
local price = config.Price.Value
local RebirthButton = game.Players.LocalPlayer.PlayerGui.RebirthGui.RebirthFrame.ScrollingFrame.Rebirth

local debounce = false

script.Parent.Activated:Connect(function()
	if debounce then
		return
	end

	debounce = true
	rep.Rebirth:FireServer(price)

	if game.Players.LocalPlayer.leaderstats.Rebirths.Value >= 1 then
		local newprice = price * game.Players.LocalPlayer.leaderstats.Rebirths.Value * 2
		task.wait(0.01)
		RebirthButton.Text = "1 Rebirth - " .. newprice .. " Clicks!"
	end

	debounce = false
end)

If there is any solution on a fix so i only have to click once to update let me know because it skips the line of the text and needs 2 clicks like said

1 Like

The problem is whenever you FireServer() I’m assuming there would be a delay between the server and the client so you would need to add a task.wait before the if statement or create another RemoteEvent to be fired on the server back at the client to update the text.

1 Like

alr that helped alot, but now i have another problem: I got a little further and now i need a little help:

i want my code to change once it has been purchased and everything works just fine, but i need to purchase first before i can get it changed! after the variables I put a piece of code in hope that it would work but it didn’t. My Current Code:

local rep = game:GetService("ReplicatedStorage").Rebirths.Rebirth2

local rebirths = game.Players.LocalPlayer.leaderstats.Rebirths

local config = script.Parent.Config
local price = config.Price.Value
local RebirthButton = game.Players.LocalPlayer.PlayerGui.RebirthGui.RebirthFrame.ScrollingFrame.Rebirth2

local debounce = false

if rebirths.Value == 0 then
	RebirthButton.Text = "10 Rebirth - " .. price .. " Clicks!" -- my try that didnt work (should be price at the beginning)
end

script.Parent.Activated:Connect(function()
	if debounce then
		print("debounce")
		return
	end

	debounce = true
	rep:FireServer(price)
	wait(0.2)

	if rebirths.Value > 0 then
		local newprice = (price * rebirths.Value) * 2
		task.wait(0.01)
		RebirthButton.Text = "10 Rebirth - " .. newprice .. " Clicks!" ---- this took 2 clicks to update 
		price = newprice
	end
	debounce = false

	rebirths:GetPropertyChangedSignal("Value"):Connect(function()
		if debounce then
			print("debounce")
			return
		end

		debounce = true
		rep:FireServer(price)
		wait(0.2)

		if rebirths.Value > 0 then
			local newprice = (price * rebirths.Value) * 2
			task.wait(0.01)
			RebirthButton.Text = "10 Rebirth - " .. newprice .. " Clicks!" ---- this took 2 clicks to update 
			price = newprice
		end
		debounce = false
	end)
end)

are you getting any errors in the output?

No, I don’t but it doesnt let it change text else if rebirth bought

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