String number error

So basically,I used the profileservice module and try to compare the value of it.
But I got this output:

Attempt to compare string <= number

But I already tonumber() all the value
Also the default value of Data.stat.rec is 0

Here is the script:


Local Data = datamanager:Get(player)
Local comp = tonumber(Data.stat.rec)
print(comp) --output is 0
Local average = tonumber(roundedaverage)
print(average) --output is 0.6777777
If comp <= 0 then --error occured
...
else if average <= comp then
...
end
end

Local Data = datamanager:Get(player)
if Data then
Local comp = tonumber(Data.stat.rec)
print(comp) --output is 0
Local average = tonumber(roundedaverage)
print(average) --output is 0.6777777
If comp <= 0 then --error occured

else if average <= comp then

end
end
else
print(“no data”)
end

remove tonumber from “local comp” and do this.

If tonumber(comp) <= 0 then

Doesnt make sense using tonumber and later making it a string again