Alright everyone right now I have a slightly working inventory with stacks and it works perfectly fine but for mobile players there is a glitch where you cant eat or use the tools if you have a stack Ill show you what I mean. Screen Recording 2023-10-07 at 2.25.35 PM.mov - Google Drive – the video
but it works perfectly fine when I use the computer keys to equip it.
local function handleEquip(tool)
if tool.Parent == nil or tool.Parent == Backpack then
Character.Humanoid:EquipTool(tool)
elseif tool.Parent == Character then
Character.Humanoid:UnequipTools()
end
end
thats the line that is triggering the output for mobile
14:25:51.237 The Parent property of Cookie is locked, current parent: NULL, new parent DemonicPandazYT - Client - BackpackScript:30
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then
return
end
if KEY_DICTIONARY[input.KeyCode.Name] then
local index = KEY_DICTIONARY[input.KeyCode.Name]
local tool = items[index]
if tool and not tool.Parent then
for i, v in ipairs(stackedItems) do
if tool.Name == v.Name then tool = v end
end
end
if tool then
handleEquip(tool)
end
end
end)