Lua Compare Help

Hey I’m trying to make a BAC limiter so the players BAC is set over 0.8 it will just say “positive” but lua comparing is not wanting to work for me. Help would be very nice!

if args[1] == "/bactest" then
	CancelEvent()
	if args[2] ~= nil then
		if (tonumber(args[2]) ~= nil) then
			if bac[tonumber(args[2])] > 0.8 then
					TriggerClientEvent('showNotification', -1,"~b~BAC: ~g~Positive")
				else
					TriggerClientEvent('showNotification', -1,"~b~BAC: ~r~NEG")
				end

Error I get in the console is “attempt to compare number with string” so how should I do it instead?

I assume that

bac[tonumber(args[2])] 

returns an string, when you compare it with 0.8, it will spit out an error.


Also providing the full error and which line of code the error occurs on would be handy.

Yes, so how should I do it instead of

if bac[tonumber(args[2])] > 0.8 then