From 9a57f852b1bbb31496002ef9beee57ba6e6c265a Mon Sep 17 00:00:00 2001 From: RuksH4n <77233680+rukshanchamindu@users.noreply.github.com> Date: Fri, 7 Nov 2025 21:59:18 +0530 Subject: [PATCH] fix: replace boolean logic with math.max for tempCarryTable aggregation Replaced the old `and/or` logic in the recipe ingredient loop with `math.max` to ensure tempCarryTable[k] always stores numeric values instead of booleans. This prevents "attempt to compare boolean with number" errors during crafting data aggregation. --- shared/crafting.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/crafting.lua b/shared/crafting.lua index de89e9f..30244a9 100644 --- a/shared/crafting.lua +++ b/shared/crafting.lua @@ -121,7 +121,7 @@ function craftingMenu(data) for k, v in pairs(Recipes[i]) do if not excludeKeys[k] then if not Recipes[i].amount then Recipes[i].amount = 1 end - tempCarryTable[k] = tempCarryTable[k] and (tempCarryTable[k] < Recipes[i].amount) or Recipes[i].amount + tempCarryTable[k] = math.max(tempCarryTable[k] or 0, Recipes[i].amount) end end end @@ -596,4 +596,5 @@ RegisterNetEvent(getScript()..":Crafting:GetItem", function(ItemMake, craftable, -- Optionally, add experience here: -- for example: -- if isStarted("core_skills") then exports["core_skills"]:AddExperience(src, 2) end -end) \ No newline at end of file + +end)