Basically when said player gets 1m cookies they can purchase this upgrade which will 1.2 * their Cookies every click.

However trying to figure out how to make the cost of the upgrade 1m cookies * 2 every time its clicked and have the GUI Text Button's text change according to the number of clicks.

example - player reach 1m cookies then clicks upg5 they get the 1.2 bonus and then the GUI and Cost should increase be 2. So, it was 1m now its 2m and then GUI text should say 2m and so on forever or if i add a max to it...

local value2 = script.Parent.Value2
local plr = game.Players.LocalPlayer
local upg5 = script.Parent.upg5

upg5.MouseButton1Click:Connect(function()
	if plr.leaderstats.Cookies.Value >= 1000000 then
	plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 1000000
	value.Value = value.Value * 1.2
	plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + value2.Value
	end
end)

** Update **

I ended up doing the long way here is what i did

local rb1 = script.Parent.rb1
local rb2 = script.Parent.rb2
local rb3 = script.Parent.rb3
local rb4 = script.Parent.rb4
local rb5 = script.Parent.rb5

rb5.Visible = false
rb4.Visible = false
rb3.Visible = false
rb2.Visible = false
rb1.Visible = true

rb1.MouseButton1Click:Connect(function()
	if plr.leaderstats.Cookies.Value >= 2000000 then
	plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 2000000
	value.Value = value.Value * 1.2
	plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + value2.Value
	end
	rb1.Visible = false
	rb2.Visible = true
end)

rb2.MouseButton1Click:Connect(function()
	if plr.leaderstats.Cookies.Value >= 4000000 then
	plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 4000000
	value.Value = value.Value * 1.2
	plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + value2.Value
	end
	rb2.Visible = false
	rb3.Visible = true
end)

rb3.MouseButton1Click:Connect(function()
	if plr.leaderstats.Cookies.Value >= 8000000 then
	plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 8000000
	value.Value = value.Value * 1.2
	plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + value2.Value
	end
	rb3.Visible = false
	rb4.Visible = true
end)

rb4.MouseButton1Click:Connect(function()
	if plr.leaderstats.Cookies.Value >= 10000000 then
	plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 10000000
	value.Value = value.Value * 1.2
	plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + value2.Value
	end
	rb4.Visible = false
	rb5.Visible = true
end)

rb5.MouseButton1Click:Connect(function()
	if plr.leaderstats.Cookies.Value >= 12000000 then
	plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 12000000
	value.Value = value.Value * 1.2
	plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + value2.Value
	end
	rb5.Visible = false
end)


If you guys knew of a shorter way to do this please, reply with code thanks...

2 comments

0

well, you should handle this stuff on the server as changes made on the client don't replicate to the server

0

I have filtering enabled