One Value is larger than the other, but output claims otherwise?

I have a local script that compares the players “cash” and the cost of an upgrade, and if the player can afford the upgrade, a remote event is triggered. The code usually works, but when the players cash is to high (usually at least double the cost of the upgrade) the code will claim the cost is higher.
The local script:

local module = require(script.ModuleScript)
local player = game.Players.LocalPlayer
local mainframe = game.Workspace:WaitForChild("PotatoFarmUpgrades").SurfaceGui.MainFrame

de1 = false
mainframe.ValueFrame.TextButton.MouseButton1Click:Connect(function()
	if player:WaitForChild("TrueStats").TruePotatoes.Value >= player:WaitForChild("TrueStats").ValueCost.Value then
		de1 = true
		game.Workspace.Upgrade.RemoteEvent:FireServer("UpgradeValue")
		wait(1)
		de1 = false
	else
		print(player.TrueStats.TruePotatoes.Value, player.TrueStats.ValueCost.Value)
	end
end)

If the cost is higher than the “potatoes” Value, the number of potatoes and cost are printed.
Examples of failed comparisons where the potato value is clearly larger:
12631 and 4800
136548 and 54675
What do I do?

debug both values on client and on server

Can you please confirm that the TruePotatoes and ValueCost things are IntObjects / NumberObjects, as opposed to StringObjects?

1 Like

Oh, that’s the problem. I was using String Values to avoid the integer number cap. Thanks!

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