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

Where does an item go when the player is holding it and how to locate it?

Asked by
wddfrt 21
3 years ago

This is a script that takes the items in the player's backpack and puts the names of those things into the table things as a string. My problem is that when the player is holding an item, the item disappears from their backpack which means that it wont be located by the for loop. How could i modify this so that if they are holding an item, it finds it as well?

local things = {}

for _, v in pairs (player:GetChildren("Backpack")) do
    things[v.Name] = v.Name
end
0
I believe you could use ChildAdded for this, unless that is not what you're trying to do. DeceptiveCaster 3761 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

When they are holding it, it goes into the players character. To get the tool and it's info use:

local tool = player.Character:FindFirstChildWhichIsA('Tool')

-Ducky

Developer

Youtuber

Ad
Log in to vote
0
Answered by 3 years ago

When they are holding it, it goes into the players character. Use player.Character:FindFirstChild("ToolName") for this.

0
The problem with this is that I do not know the tool they are holding wddfrt 21 — 3y

Answer this question