Hi. Question for this Hotbar. In line 119 and 100, it doesn't unequip the tools.
I tried searching on the internet for the method to unequip and it is exactly the same with no errors whatsoever.
Everything works fine such as equipping tools, the Hotbar UI, the uis part, and the events.
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false) -- Tables and vars local num = { '1', '2', '3', '4', '5', '6', '7', '8', '9', } local numinwords = { 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', } local tools = { [1] = 'None' , [2] = 'None' , [3] ='None', [4] = 'None' , [5] = 'None' , [6] = 'None', [7] = 'None' , [8] = 'None' , [9] = 'None' , } local uis = game:GetService('UserInputService') local plr = game.Players.LocalPlayer local backpack = game.Players.LocalPlayer:WaitForChild('Backpack') local frame = script.Parent repeat wait() until plr.Character local char = plr.Character wait(1) for i, v in pairs(backpack:GetChildren()) do tools[i] = v frame[i].Image = 'rbxassetid://'..v.ID.Value end --Events backpack.ChildAdded:Connect(function(tool) for i, v in pairs(tools) do if v == 'None' then frame[i].Image = 'rbxassetid://'..tool:WaitForChild('ID').Value tools[i] = tool break end end print(tools) end) backpack.ChildRemoved:Connect(function(tool) for i, v in pairs(tools) do if v == tool then if char:FindFirstChild(tool) then else tools[i] = 'None' frame[i].Image = '' end break end end print(tools) end) for i, v in pairs(frame:GetChildren()) do if v:IsA('ImageButton') then uis.InputBegan:Connect(function(input) local n = tonumber(v.Name) if input.KeyCode == Enum.KeyCode[numinwords[n]] then if tools[tonumber(v.Name)] ~= 'None' then char.Humanoid:UnequipTools() if char:FindFirstChild(tools[tonumber(v.Name)].Name) then char.Humanoid:UnequipTools() else char.Humanoid:EquipTool(tools[tonumber(v.Name)]) end end end end) end end for i, v in pairs(frame:GetChildren()) do if v:IsA('ImageButton') then v.MouseButton1Click:Connect(function() if tools[tonumber(v.Name)] ~= 'None' then char.Humanoid:UnequipTools() if char:FindFirstChild(tools[tonumber(v.Name)].Name) then char.Humanoid:UnequipTools() else char.Humanoid:EquipTool(tools[tonumber(v.Name)]) end end end) end end