If this is obvious, don't laugh at me, because I haven't learned the function/keyword/statement/method/whatever yet, obviously.
How do I tell which player is holding a tool?
1 | local Tool = script.Parent |
2 |
3 | Tool.Equipped:connect( function () |
4 | local Character = Tool.Parent |
5 | local Player = game.Players:GetPlayerFromCharacter(Character) -- Returns the player's object |
6 | print (Player) |
7 | end ) |
Tested and works.
The easiest way is to check all the players characters and using "FindFirstChild". If it's in a server script, you'd want to do
1 | for _,character in pairs (workspace:GetChildren()) do |
2 | if character:FindFirstChild( "ToolName" ) then |
3 | print ( 'Found Tool' ) -- and place whatever you want here |
4 | end |
5 | end |
There are other methods, but this is the first that comes to mind. Hope that helps!