Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to check slot of tool in backpack?

Asked by 4 years ago

I am developing a backpack managing script, and I'd like to know how how to check the slot of a tool. Obviously, I can check the order they appear in, but that won't include the tool currently being held or any gaps, therefore giving me incorrect answers.

Is there a function or property I can use? So far I have found none on the wiki, on both the tool and backpack pages.

0
:GetChildren if you want to get the children of the backpack. But i'm not quite sure what you mean, sorry. kingblaze_1000 359 — 4y
0
Not sure what you mean, but try to use for loop like: TTHKKB 12 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

Asked this in the discord, apparently, you cannot check it. If you're trying to do this, you're going to have to make a custom backpack system.

Ad
Log in to vote
0
Answered by
TTHKKB 12
4 years ago

Not sure what you mean but you can try using for loop

game.Players.PlayerAdded:Connect(function(plr)
for i,v in pairs (plr.Backpack:GetCHildren()) do
if v:IsA("Tool") then
 -- Code here
end
end
end)

Answer this question