here’s what I tried sorry if it’s a little messy
local UIS = game:GetService(“UserInputService”)
-- Player Variables
local Player = game.Players.LocalPlayer
local Backpack = Player:WaitForChild("Backpack") or Player.Backpack:Wait()
local char = Player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
UIS.InputBegan:Connect(function(input)
local num = 0
if input.KeyCode == Enum.KeyCode.One then
num = 1
elseif input.KeyCode == Enum.KeyCode.Two then
num = 2
elseif input.KeyCode == Enum.KeyCode.Three then
num = 3
end
if num ~= 0 then
print(num)
local Items = Backpack:GetChildren()
local toolToEquip = Items[num]
if toolToEquip then
for i, v in pairs(Items) do
if v:IsA("Tool") then
print(v.Name.." is on ur backpack")
v.Equipped:Connect(function()
hum:UnequipTools(v)
end)
end
end
hum:EquipTool(toolToEquip)
end
end
end)
There is errors with your script but but the main issue is that if your tools are in different orders when equipping tools with be inconsistent. For example 1 may equip “a” tool but then you unequip the tool it will be placed somewhere else in the backpack directory.
The easiest way in my opinion would to be add values to tools and look for them when you equip a tool. For example Tool A will have a value of 1 so when you click 1 it find that exact tool and Tool B will have a value of 2 so when you click 2 it will also find that exact tool, and so on.
Wait could u explain how u figured it out? I’m making a cod zombie game and i managed to figure out the mystery box, perks, pack-a-punch, power and much more…but I couldn’t figure out this lmao. So can u explain the whole remote event thing tysm!