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!
Check to see if the child is a HopperBin object as well.
if child:IsA("Tool") or child:IsA("HopperBin") then