Find tool in player's backpack by number

I’m Lap_124, a roblox developer.

I need to find tool in player’s backpack but instead of finding the tool by its name, I want to find it by a number

I tried this:

local Player = game.Players.LocalPlayer
local Backpack = Player:WaitForChild("Backpack") or Player.Backpack:Wait()

local num = 1
local Items = Backpack:GetChildren()
local tool = Items[num]

The tool variable is equal to nil
I only showed important things
Please help me

Note: It’s my first subject and I’m French so sorry if I make grammatical mistakes :sweat_smile:

1 Like

The code you’re showing looks correct to me. Are you sure there are actually items in the backpack when this code is run?

It’s also important to remember that when a player equips an item, the Tool object actually moves out of the Backpack folder and into the player’s character model in the workspace.