Checking if player has a tool in backpack with a proximity prompt

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    Hello, so in my script i have a table that contains tools names. And i want to do that when the ProximityPrompt is triggered if the player has a tool in his backpack that is in the table then it do something.

  2. What is the issue?
    I don’t know how to search the tool in the table.

  3. What solutions have you tried so far?
    Checked on devhub, found something similar but it didn’t helped.

The proximity prompt gives the player instance when triggered. And all the tools are held in the backpack. So you can check with :FindFirstChild, and then if you do find it, then you do something. : |

I need a more clear idea of how i can do it

Just to restate what Ben said more clearly

local Player = game.Players.LocalPlayer
local PlayerBackpack = Player.Backpack
local ToolTable = {} --// Just imagine values
local Found = false
for i,ToolName in ipairs(ToolTable) do
if  PlayerBackpack:FindFirstChild(ToolName) then
Found =  true
end
end

Sorry Didn’t read your issue clearly fixing

I need to know how to search in the table

Yep. You can ask me for help. Just PM me :slight_smile:

/s

I don’t believe my example is what you needed. Could you let me know after you test if it worked out fine or any alterations you need.

It worked fine i just did some small modifications on it

1 Like