I found this post which was most relevant to my problem.
In the solution, I used the sample provided in the solution in my code.
I tried to both implement it and unequipping with this code sample.
local keybinds = {"One","Two","Three","Four"}
userinputservice.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if table.find(keybinds,input.KeyCode.Name) then
local toolName = _G.data.equippedWeapons[input.KeyCode.Name]
if toolName then
local tool = player.Backpack:FindFirstChild(toolName)
if tool then
char.Humanoid:EquipTool(tool)
--Unequipping is intentionally disabled for my game's purposes, but it's not that hard to do either
elseif char:FindFirstChild(toolName) then
tool.Parent = player.Backpack
end
end
end
end)
It did not work. at all.
What is the issue here?