Script doesn't detect the number in a string

I am making a cashapp system, so you can transfer money to other players. I am using a textbox so they can input the amount of money they would like to send. But it won’t work.

Local script:

game.ReplicatedStorage.transferCash:FireServer(script.Parent.Parent.amountBox.Text, script.Parent.Parent.usernameBox.Text)

Server script:

game.ReplicatedStorage.transferCash.OnServerEvent:Connect(function(plr, amount, target)
	if plr.leaderstats.Cash.Value >= amount then
		plr.leaderstats.Cash.Value -= amount
		game.Players:FindFirstChild(target).leaderstats.Cash.Value += amount
	end
end)

Error:

ServerScriptService.iMessagesHandler:6: attempt to compare string <= number  -  Server - iMessagesHandler:6

Text is a string value and you’re not converting that to an int, meaning you’re checking if the players cash (a number) is greater than or equal to a string. To fix this, you can simply do tonumber(amount) and that’ll make it into an int/ float, fixing the problem.

game.ReplicatedStorage.transferCash.OnServerEvent:Connect(function(plr, amount, target)
    amount = tonumber(amount)
	if plr.leaderstats.Cash.Value >= amount then
		plr.leaderstats.Cash.Value -= amount
		game.Players:FindFirstChild(target).leaderstats.Cash.Value += amount
	end
end)