Unable to check Value

I am trying to do an if amount < 0 check, but it doesn’t work. How do I fix it?

Local Script:

script.Parent.TransferContainer.Button.MouseButton1Down:Connect(function()
	local remote = game:GetService("ReplicatedStorage").SendCoins
	local recipient = script.Parent.Username.Button.Frame.TextLabel.Text
	local amount = tonumber(script.Parent.Amount.Button.Frame.TextLabel.Text)
	if amount < 0 then
	if amount > 10000000 then
		script.Parent.Amount.Button.Frame.TextLabel.Text = "Transfer Limit Reached!"
	else
		print("Tranferring coins...")
			remote:FireServer(recipient, amount)
		end
	end
end)

Server Script:

local remote = game:GetService("ReplicatedStorage").SendCoins
local Data = require(script.Parent.Internal:WaitForChild("Data"))

remote.OnServerEvent:Connect(function(player, recipient, amount)
	local newamount = (tonumber(amount) * 0.80)
	local receiver = game.Players:FindFirstChild(recipient) 
	if newamount < 0 then
	if Data(player).Replica.Data.Coins >= amount then
		Data(player):GiveCurrency("Coins", -amount)
		Data(receiver):GiveCurrency("Coins", newamount)
			print("Finished Transfer Request")
		end		
	end
end)

You’re checking if the amount is less than zero. The “mouth” is eating the bigger number, 0. Your post doesn’t include much info other than the code…

Ok so, I put -1000 and test it. I don’t want it to print the number with “-” but it printed.

You’re doing tonumber() on a textlabel. Are you sure this is a numerical value? tonumber() will return nil if it’s not, thus nil < 0 will throw an error. What’s the specific error?

In-case it’s comma formatting, tonumber(1,000,000) will fail, tonumber(1000000) will not.

use math.abs to convert a negative number to a positive number.

You need to explain what you are trying to do.
I’m just guessing, but it looks like you are process a purchase and if the player doesn’t have enough money then the purchase isn’t successful.
So

total = money amount - purchase
If total > 0 then 
    purchase allowed
else 
    purchase not allowed
end

I am making a transfer system. But it result that doing - can remove player’s money

It looks like the code has a syntax error.

if amount < 0 then
if amount > 10000000 then
	script.Parent.Amount.Button.Frame.TextLabel.Text = "Transfer Limit Reached!"
else
	print("Tranferring coins...")
			remote:FireServer(recipient, amount)
	end
end

^ This code is equivalent to this code:

if amount < 0 then
	if amount > 10000000 then
		script.Parent.Amount.Button.Frame.TextLabel.Text = "Transfer Limit Reached!"
	else
		print("Tranferring coins...")
		remote:FireServer(recipient, amount)
	end
end

It makes sense the code would never have the amount less than zero AND greater than 10,000,000.

To solve your problem simply fix your syntax. You have the same problem down here:

local remote = game:GetService("ReplicatedStorage").SendCoins
local Data = require(script.Parent.Internal:WaitForChild("Data"))

remote.OnServerEvent:Connect(function(player, recipient, amount)
	local newamount = (tonumber(amount) * 0.80)
	local receiver = game.Players:FindFirstChild(recipient) 
	if newamount < 0 then
	if Data(player).Replica.Data.Coins >= amount then
		Data(player):GiveCurrency("Coins", -amount)
		Data(receiver):GiveCurrency("Coins", newamount)
			print("Finished Transfer Request")
		end		
	end
end)

You need to close your first if statement with the end keyword or you might be looking for the elseif keyword:

local remote = game:GetService("ReplicatedStorage").SendCoins
local Data = require(script.Parent.Internal:WaitForChild("Data"))

remote.OnServerEvent:Connect(function(player, recipient, amount)
	local newamount = (tonumber(amount) * 0.80)
	local receiver = game.Players:FindFirstChild(recipient) 
	if newamount < 0 then
		-- you need an end statement or to continue the if logic, can't have multiple "if"s in a row.
	elseif Data(player).Replica.Data.Coins >= amount then
		Data(player):GiveCurrency("Coins", -amount)
		Data(receiver):GiveCurrency("Coins", newamount)
		print("Finished Transfer Request")		
		-- There was also a random "end" here to make the syntax acceptable/runnable.
	end
end)