if SlotProfile.Data.Inventory.QuickAccess.Weapons == {} then
return nil
else
print(SlotProfile.Data.Inventory.QuickAccess.Weapons)
return SlotProfile.Data.Inventory.QuickAccess.Weapons[SlotProfile.Data.Inventory.Equipped.Weapon]
end
1 Like
Tables can be a bit tricky. Here, it’s checking whether the tables are quite literally the same table in memory. SlotProfile.Data.Inventory.QuickAccess.Weapons and {} are two different tables in memory, therefore, it returns false. Instead, you should check whether there is anything inside of SlotProfile.Data.Inventory.QuickAccess.Weapons (assuming it is an array-style table) by doing:
if #SlotProfile.Data.Inventory.QuickAccess.Weapons <= 0 then
-- Table is empty
else
-- Table is not empty
end
5 Likes
tables are references, use typeof(Weapons) == "table"
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.