How to make a tool scanning system and when it finds the tool the button will dissapear?

Hi everyone,

I am having a bit of trouble here. I am a beginner at scripting. How would I make a script that would scan for a tool?

1 Like

Your question is incredibly vague.

If you could clarify as to what you’re trying to do, we’ll be better suited to help you.

Ok. I am trying to make a button disappear when a tool is in the players backpack. Please tell me if you need me to clarify it even more. Thank you.

You can just loop through the Backpack to check for tools, and then if there are any tools, turn the Visible property for the Gui Object to false. I’m not gonna write out the code for you, but if you don’t know how to loop through, you would do:

for i, v in pairs(Backpack:GetChildren()) do
 -- blah blah blah 
end

or

for i, v in ipairs(Backpack:GetChildren()) do
 -- blah blah blah 
end

Hope this helps.

1 Like

Hi,

Thanks for your reply. Do I put this in ServerScriptService and is it a LocalScript or a normal script?

It depends, but I would suggest letting the server handle Guis and tools, (this is just based off of my personal opinion and experience). If you’re letting the server handle it, you should put the code in a “normal” script located in the ServerScriptService. If you’re letting the client handle it, you should put the code in a LocalScript, and it honestly doesn’t matter where you put the LocalScript (but, I do suggest putting it in StarterGui).