Rebirth System not doubling when you Rebirth

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a Rebirth System that every time you rebirth the new cost doubles.
  2. What is the issue? Include screenshots / videos if possible!
    The issue is it sometimes doubles on the GUI and it can’t go past 10
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    No, because I know that none of the functions I used were deprecated. I tried getting help from other communities, but no one answered.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local player = game.Players.LocalPlayer  
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RebirthFunction = ReplicatedStorage:WaitForChild("Rebirth")

local MaxLevel = 5


local OpenrebirthFrame = script.Parent:WaitForChild("RebirthOpen") 
local RebirthFrame = script.Parent:WaitForChild("RebirthFrame") 
local RebirthButton = RebirthFrame:WaitForChild("Rebirthing") 
local leaderstats = player:WaitForChild("leaderstats") 
local Rebirths = leaderstats:WaitForChild("Rebirths") 



OpenrebirthFrame.MouseButton1Up:Connect(function() 
	RebirthFrame.Visible = not RebirthFrame.Visible 
	
	RebirthFrame.Multiplier.Text = "Your new multiplier will be "..Rebirths.Value + 2  .. "x" 
end) 

RebirthButton.MouseButton1Up:Connect(function(player) 
	local Wins = leaderstats:WaitForChild("Wins")
	local didPlayerRebirth = RebirthFunction:InvokeServer()  
	print(didPlayerRebirth)
	print(Wins.Value) 
	
	if Wins.Value >= MaxLevel  then 
		
		didPlayerRebirth = true  
		
		local newMultiplier = Rebirths.Value + 2 

			RebirthFrame.Multiplier.Text = "Your new multiplier will be "..newMultiplier  .. "x"
		
		local newCost = MaxLevel * 2 

			RebirthFrame.Cost.Text = "Cost: " .. newCost .. "Wins"
	end
end)
	```


Please do not ask people to write entire scripts or design entire systems for you. If you can't answer the three questions above, you should probably pick a different category.

You’re setting everything in a local script. Assuming the store where you buy stuff is handled by a sever script, the server script can’t see the changes from client side so it wouldn’t multiply until you change it in the server side. You would have to change the Rebirths.Value in the server and not the client in order for this to work.

I believe it would be more efficient if I show you the server script so you would get more context of what is going on. My apologies for now showing the server script on the post. Here it is ```lua
RebirthFunction.OnServerInvoke = function(player)
if player.leaderstats.Wins.Value >= MaxLevel then
MaxLevel = MaxLevel * 2
player.leaderstats.Rebirths.Value = player.leaderstats.Rebirths.Value + 1
player.leaderstats.Wins.Value = 0

		player.Character.Humanoid.JumpHeight = 0
	
	end 
	return true
end```
RebirthFunction.OnServerInvoke = function(player) 
		if player.leaderstats.Wins.Value >= MaxLevel  then
			MaxLevel = MaxLevel * 2
			player.leaderstats.Rebirths.Value = player.leaderstats.Rebirths.Value + 1 
			player.leaderstats.Wins.Value = 0 
			
			player.Character.Humanoid.JumpHeight = 0
		
		end 
		return true
	end```

Oh. I don’t see where you used the RemoteFunction in the local script. Is it in another script?

No I showed you the entire local script. The remote function is called Rebirths. It is not directly called remote function but accessed as “Rebirths”

As @TheLordGamer1820 has said in his post, you should only handle rebirth counts on the server and not the client. This is because:

  • You are exposing the rebirth system on the client side, which is vulnerable for exploiters to take advantage of it.
  • Attempting to do any changes on the client without a valid pathway between the client and the server will not be replicated from the client to the server.
4 Likes

Can you send a LocalFile ASAP, please?

Thank you for your advice, but how would I create a valid pathway between the client and the server?

The issue does not lie with in the rebirth system not doubling when you rebirth you do, but the issue is that the GUI does not show it for whatever reason it may be. Edit: Never mind the issue is it does double but it doubles for everyone which is not what I want. It doubles on the Server Script but I want it to double on the Local Script.

Consider checking out Remote Events.

So remote functions wouldn’t be useful in this case?

I said that could you send a LocalFile, As Soon As Possible.

I want to fix your issue (I mean everyone with issues must be fixed 1 day, and it’s not certainly me, it’s others).

I am sorry for inconvenience, but I am not familiar with Local Files, can you please inform me what they are so I can give you the most information as possible?

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