How do I get the name of someone holding a tool?
✓ ANSWER ACCEPTED
How to get owner of tool?
2 answers
✓ Accepted answer
In order to do this, we need to understand how tools work.
So, when a player has a tool with them that is unequipped it is located in the Players Backpack. When they have the tool equipped, it is inside there Character.
Knowing this, we can find the Player holding it, but we'll need the script to be able to distinguish it's potential parents from one another. Here's an example (The script is inside the tool) :
Tool=script.Parent
function CheckPlayer()
local Player=nil
if Tool.Parent.Name == "Backpack" then
Player = Tool.Parent.Parent --Finds the Player using the Backpacks Parent.
else
Player = game.Players:FindFirstChild(Tool.Parent.Name) --Finds the Player using the Character's name, and searching through the Player's in game.
end
return Player
end
print(CheckPlayer()) --Prints the player's name.
Anyways, I hope this helped you out a bit :P
Tool.Parent.Name, Tool is a child of the Player's character in workspace, then you just get the Name of that character
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This doesn't work if the Tool is in the Player's backpack though.
true