Pretty self explanatory. I would like to check if a player equipped a tool thanks in advance for the help
✓ ANSWER ACCEPTED
How to check if a player has a tool equipped in their hand?
1 answer
✓ Accepted answer
When you equip a tool, it ends up inside the character. When you want to check if a tool is being equipped, call this function:
local character = game.Players.LocalPlayer.Character
function toolEquipped(character)
for _, child in pairs(character:GetChildren()) do
if child:IsA("Tool") then
return true
end
end
return false
end
if(toolEquipped(character))then
print("There is a tool equipped")
else
print("there is not a tool equipped")
end
If you want t know if a certain tool is equipped, then check the Tool's equipped property:
Tool.Equipped:Connect(function(mouse)
print("Tool was equipped")
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

18 comments
ill try your script in a second
alright. also, please indent the return on line 6. i tried but for some reason it ended up like that in the formatting
so i have to delete it? i don't know the word "indent" sorry. my first language isnt enlish
no, and that's okay. i just mean press the 'Tab' key on your keyboard on line 6. Doesn't do anything, just makes it easier to read.
but the script doesn't work
i get an error on line 4 saying that the character is a nil value
is it in a normal script or local script?
the code above needs to be a local script. if you want to do it in a normal script, you're going to need to know what player you want beforehand
it's a local script
replace line one with this code:
player = game.Players.LocalPlayer local char = player.Character or player.CharactedAdded:wait()
hmm still doesn't work
i have had the local script parented to the tool was that ok?
i'll check it out later today after class im starting a class rn
thats fine
:p thanks for all the help. it was me beeing stupid this whole time :/ sorry for wasting this much of your time
you didn't waste my time. don't worry about it.
i'm glad you got it working