Attempt to compare number <= table

Hi,

can anyone tell me why I am getting the error below on the last line 61,

ServerScriptService.PetSystem.Modules.PetHandler:61: attempt to compare number <= table - Server - PetHandler:61

local lMoney = DataStore2("Money", Player)
	local lEggPrice = EggInfo[Egg].Price[1]
	
	if Type == 1 then
		print("lMoney = " .. tostring(lMoney:Get(0)))
		print("EggPrice = " .. tostring(lEggPrice))
		
		if lMoney >= lEggPrice then
1 Like

What is the value of that? Is .Price a table?

1 Like

hi, yes

local EggInfo = {
[“Common Egg”] = {
Price = {100},
ProductID = nil,
Pets = {
[1] = {“Dog”,60,1},
[2] = {“Cat”,25,2},
[3] = {“Bunny”,10,3},
[4] = {“Bear”,5,4},
}
},

1 Like

The error is self explanatory, lMoney is a table. You probably forgot to actually get the value of money from the money datastore.

local lMoney = DataStore2("Money", Player)
	local lEggPrice = EggInfo[Egg].Price[1]
	
	if Type == 1 then
		local Money = lMoney:Get(0) -- get value of money from datastore
		print("lMoney = " .. tostring(Money))
		print("EggPrice = " .. tostring(lEggPrice))
		
		if Money >= lEggPrice then
1 Like

Thanks that was the issue,

Thanks
Julian

1 Like