Hi, I'm working on a project that requires to know the name of tools in a local player's backpack. How can i get the name of those tools? Like can i form a table? Please help me!
COMMUNITY QUESTION
How can I know the name of tools in a backpack ?
2 answers
Put a LocalScript in the StarterGui:
wait()
local player = game.Players.LocalPlayer
local backpack = player.Backpack
for i,v in pairs(backpack:GetChildren()) do
print(backpack:GetChildren()[i].Name) -- OR
print(v.Name)
end
Keep in mind this is not tested, and it might not work. Hope this helps!! :D
you can loop through the backpack to find all the tools like this
local player = game.Players.LocalPlayer
local backpack = player:WaitForChild("Backpack")
for _,v in pairs(backpack:GetChildren()) do
-- if v:IsA("Tool") then -- If you want only tools
print(v.Name)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
this is not a script request site