Upgrade ain't working proper

local upgraderemote =    game.ReplicatedStorage:WaitForChild("Upgrade")


local upgrades = {
	{ Name = "SingleCoins", Cost = 50, Multiplier = 1 },
	{ Name = "DoubleCoins", Cost = 100, Multiplier = 2 },
	{ Name = "TripleCoins", Cost = 150, Multiplier = 3 },
	{ Name = "QuadCoins", Cost = 200, Multiplier = 4 },
}

local function findNextUpgrade(player,currentUpgrade)
	for _, upgrade in upgrades do
		print("Checking upgrade:", upgrade.Name, "with Multiplier:", upgrade.Multiplier)
		if upgrade.Multiplier == currentUpgrade + 1 then
			return upgrade
		end
		print(currentUpgrade)
		print(upgrade.Multiplier)
end
		return nil
end

local function handleUpgrade(player)
	local coins = player.leaderstats["🌈Lucky Blocks"].Value
	local level = player.leaderstats.Level.Value
	local upgrade = findNextUpgrade(player, level)
	

	if coins >= upgrade.Cost then
		coins = coins - upgrade.Cost
		player.leaderstats["🌈Lucky Blocks"].Value = player.leaderstats["🌈Lucky Blocks"].Value * upgrade.Multiplier
	else
		print("NO WORK")
			end
	print(coins)
	print(upgrade)
		upgraderemote:FireClient(player)
	game.StarterGui.Upgrade.FrameUpgrade.UpgradeButton.Level.Text = "Level:"..coins
	end

upgraderemote.OnServerEvent:Connect(handleUpgrade)

Client script -
local player = game.Players.LocalPlayer
local upgradeButton = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local upgradeRemote = ReplicatedStorage:WaitForChild("Upgrade")


upgradeButton.MouseButton1Click:Connect(function()
	upgradeRemote:FireServer(print("Fired"))
end)

upgradeButton.MouseEnter:Connect(function()
	upgradeButton.Size = UDim2.fromOffset(535, 115)
end)

upgradeButton.MouseLeave:Connect(function()
	upgradeButton.Size = UDim2.fromOffset(505, 95)
end)

It doesn't upgrade to another level when i click the upgrade button, here's what it prints: 
![image|690x347](upload://oHG9FDi6obubco6TOEjUD43efV3.png)
1 Like

Do you get any errors or warnings in the output, if so can you tell me what it printed? And what do you want to achieve? Because just giving the script and saying it doesn’t work properly isn’t really enough info to help.