I have a script and I only want it to work if the player has no tools selected. How could I define no tools being selected? Basically what I'm asking is, how can I say in Lua "when the player has no tool selected"? Someone suggested this function below, but It only works for an actual tool, not a Hopperbin script based tool like I have.
function isToolEquipped()
local character = player.Character
if character then
for _, child in next, character:GetChildren() do
if child:IsA("Tool") then
return true
end
end
end
return false
end
Thanks for any help guys and let me know if I need to clarify anything!

2 comments
I tried that but since The HopperBin Tools don't leave your backpack when equipped it doesn't work
Sorry, forgot about that! HopperBins have an "Active" property that is set to true when the bin is equipped. You can iterate over the players backpack and check if this property is true.