Click value not changing after Rebirth value is changed

Currently working on a simulator type game and I’m making a rebirth thing right now. I’m currently trying to make it so when you have a rebirth of one or more then every time you click you will get 5 clicks every time instead of one without the rebirth. The issue is that it’s not working. I’ve tried debugging it by printing but with no success.

Code:

script.GetClick.OnServerEvent:Connect(function(plr)
	local leaderstats = plr:WaitForChild("leaderstats")
	if leaderstats.Rebirths.Value >= 1 then
		leaderstats.Clicks.Value = leaderstats.Clicks.Value + 5
		print("Rebirth Changed")
	elseif leaderstats.Rebirths.Value <1 then
		print("Rebirth Unchanged")
		leaderstats.Clicks.Value = leaderstats.Clicks.Value + 1
		end
	end)
2 Likes

You could check, for every rebirth the player has, let him earn x2 than what he’s earned before.

script.GetClick.OnServerEvent:Connect(function(plr)
	local leaderstats = plr:WaitForChild("leaderstats")
	if leaderstats.Rebirths.Value >= 1 then
		leaderstats.Clicks.Value += (leaderstats.Rebirths.Value) * 5
		print("Rebirth Changed")
	elseif leaderstats.Rebirths.Value <1 then
		print("Rebirth Unchanged")
		leaderstats.Clicks.Value += (leaderstats.Rebirths.Value) * 1
		end
	end)

What this does, is,
lets say you have 2 rebirths, and you click on the button.

You’ll get 10 clicks, instead of 5.
If you have 3 rebirths, you’ll get 15 clicks per click

1 Like