- I would like to know how to tell if my hotbar is full or not.
2.The issue is when the hotbar is full, it returns the last slot instead of returning nil, to indicate that the hotbar is full and put the item in the inventory instead.
3.Tried checking to see if the slot was occupied, but it seemed to ignore it. The problem isn’t that the hotbar stacks beyond 6 slots, it doesn’t tell me if it’s full to put it in the inventory instead.
function Handler:GetEmptySlots()
local PotentialSlots = {}
for i, v in pairs(SlotData.Slots) do
if v.CurrentTool == false then
table.insert(PotentialSlots, v)
end
end
local function lowestNumber()
local Low = 6 --// Add num
for i, v in pairs(PotentialSlots) do
if v.Index < Low and v.CurrentTool == false then
Low = v.Index
print(v.CurrentTool)
end
end
return Low
end
local num = tostring(lowestNumber())
print(num)
if num ~= nil then
return SlotData.Slots["Slot"..num]
else
return nil
end
end
Here’s the code that checks to see if the hotbar is full or not and which slot to put the weapon in.