View Backpack Tools with ProximityPrompts

Hi, I’m trying to make a keycard door system and I’m stuck on trying to figure out how to see a player’s backpack and locate a specific tool without the tool in question being equipped.

Basics
When a player finishes an interaction with a ProximityPrompt, a script should check if the player has a certin clerence (or keycard, tool) in their pack.

The user should not have to equip the tool for the system to see it.

Current Scripts
local TS = game:GetService(“TweenService”)
local player = game.Players
local door = script.Parent.Union
local ProxPrompt = script.Parent.Prox1.ProximityPrompt
local ProxPrompt2 = script.Parent.Prox2.ProximityPrompt

local accesslevel = script.Parent[“Access level”]
local PermAccess = accesslevel.Value

local TweenService = game:GetService(“TweenService”)
local TweenIn = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)

local tweenclose = TweenService:Create(door, TweenIn,{Position = Vector3.new(134.419, 4.264, -173.46)}) – change to your positions
local tweenopen = TweenService:Create(door, TweenIn, {Position = Vector3.new(134.419, 4.264, -169.494)})

ProxPrompt.Triggered:Connect(function()
if ProxPrompt.ActionText == “Close” then
tweenclose:Play()
ProxPrompt.ActionText = “Open”
ProxPrompt2.ActionText = “Open”
else
tweenopen:Play()
ProxPrompt2.ActionText = “Close”
ProxPrompt.ActionText = “Close”
wait(6)
tweenclose:Play()
ProxPrompt2.ActionText = “Open”
ProxPrompt.ActionText = “Open”
end
end)

ProxPrompt2.Triggered:Connect(function()
if ProxPrompt2.ActionText == “Close” then
tweenclose:Play()
ProxPrompt2.ActionText = “Open”
ProxPrompt.ActionText = “Open”
else
tweenopen:Play()
ProxPrompt2.ActionText = “Close”
ProxPrompt.ActionText = “Close”
wait(6)
tweenclose:Play()
ProxPrompt2.ActionText = “Open”
ProxPrompt.ActionText = “Open”
end
end)

Other
The script isn’t done yet, but we’re trying to:

  • Make the door auto-close

  • Make the ProximityPrompt view and check if the player has the needed keycard, or a higher one, if they do the door opens.

This is my first post, sorry if I made it wrong :slight_smile:

Forgot these pointers -

  • The displayed script is server-sided.
  • The script is parented to the main door model, not the door parts itself.
  • We plan to use a NumberValue to put the minimum needed access level to open the door, so the player has to have either the inputted number or higher.

Since ProximityPrompts pass a player argument when the Triggered Event is fired, you can simply iterate through the Players backpack using for i, v in pairs() do and see if v.Name is the same name of the tool you’re looking for.
Note that, you will need to change ProxPrompt.Triggered:Connect(function() to ProxPrompt.Triggered:Connect(function(Player) to have the player argument.

Edit: You can also use FindFirstChild

Also, next time, put your code in a code block using 3 backticks. (```)