Rebirth Doesn't Work As Expected

i have a script here that functions with cash and rebirths and the issue is when i reach 100 or more i get 1 rebirth
but if i reach 200 it doesn’t give me 2 rebirths (depends on if the player clicks button twice) same with 300 or more And if possible please make me a tween for my text i have made one before but doesn’t work, thank you:

x = script.Parent
plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
leaderstats = plr.leaderstats
reb = leaderstats.Rebirths
cash = leaderstats.Clicks
txt = x.Parent.Warning

x.MouseButton1Click:Connect(function()
	if cash.Value >= 100 then
		reb.Value = reb.Value + 1
		cash.Value = 0
		print(plr.Name.. " Has Got".. reb.Value.. "  Worth Of Rebirth (s) ! Keep Going !")
	else
		print("Not Enough Clicks To Rebirth! Try After Getting 100 Clicks !")
		txt.Visible = true
		wait(2)
		txt.Visible = false
	end
end)
2 Likes

The problem is that you are only adding 1 rebirth instead of using a formula to calculate how many rebirths should be added

local x = script.Parent
local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local leaderstats = plr.leaderstats
local reb = leaderstats.Rebirths
local cash = leaderstats.Clicks
local txt = x.Parent.Warning

x.MouseButton1Click:Connect(function()
	if cash.Value >= 100 then
		reb.Value += math.floor(cash/100)
		cash.Value = 0
		print(plr.Name.. " Has Got".. reb.Value.. "  Worth Of Rebirth (s) ! Keep Going !")
	else
		print("Not Enough Clicks To Rebirth! Try After Getting 100 Clicks !")
		txt.Visible = true
		task.wait(2)
		txt.Visible = false
	end
end)

This script should work

doesn’t work

1111111111111111111111111111

Can you describe the problem with this script?

so when the rebirth value reaches 200 it rebirths all the cash instead of rebirthing 100 cash

reb.Value += 1
cash.Value -= 100

??
I dont understand the goal

the script isn’t supposed to rebirth all of the money cuz its 200 it needs to rebirth 100 of it and if the player rebirths 2nd time he will have 0 cash 2 rebirths

Oh i see its suppossed to only rebirth once

then just use this

I think he means like rebirth*100 for the cash requirement
then +1 rebirth
cash = 0

thank you
111111111111111111111

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