Hello. So I'm currently trying to make an API that does a variety of things when a player kills another. I'm trying to add a line that will print out the name of a certain player's currently equipped tool.
So far I have this, I can't figure out how to find the name of the tool
1 | local baddy = Humanoid.creator.Value |
2 | local Weapon = baddy:WaitForChild( "Backpack" ) |
Thank you all for the help.
As soon as a player equips a weapon, it is moved to the player's Character
. If we wanted to find a specific tool, we could do: baddy.Character:FindFirstChild("WeaponName")
However, if we wanted to find any tool that may be equipped in the player's inventory, we can use the :FindFirstChildOfClass("Tool")
function since a tool is a Class.
1 | local ToolEquipped = baddy:FindFirstChildOfClass( "Tool" ) |
2 | print (ToolEquipped.Name) |
This should work
1 | Weapon:FindFirstChild( "Your weapon name" ) |