Strange cash add behavior

What I am trying to make is a system where you can buy a cube for an extra one dollar boost per click however when i don’t have the cube it sky rockets my money gain by a lot why does this happen and how can i fix it?
here is the script

local Debounce = false
script.Parent.MouseButton1Click:Connect(function()
	if Debounce == false then
		Debounce = true
		local amount = 1
		script.Parent.MouseButton1Click:Connect(function()
			wait(.1)
			game.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value + amount
			local CubesFound = 0
			for i,Item in game.Players.LocalPlayer.Backpack:GetChildren() do
				if Item:IsA("Tool") and Item.Name == "Grey Cube" then
					CubesFound += 1
					print("Found a Cube")
				end
			end
			task.wait(.1)
			Debounce = false
		end)
	end
end)

local Debounce = false
script.Parent.MouseButton1Click:Connect(function()
	if Debounce == false then
		Debounce = true
		local amount = 1
		
			wait(.1)
			game.Players.LocalPlayer.leaderstats.Money.Value   += 1
			local CubesFound = 0
			for i,Item in game.Players.LocalPlayer.Backpack:GetChildren() do
				if Item:IsA("Tool") and Item.Name == "Grey Cube" then
					CubesFound += 1
					print("Found a Cube")
				end
			end
			task.wait(.1)
			Debounce = false
	end
end)

Here

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