How can I see if someone already has a tool?

I am trying to make a hotel check in system. I need it to make sure no one else has a tool, then if no one else has it, it can give it to the selected user.

Use the FindFirstChild function to check if the item is in the player’s Backpack or on-hand.

if not Player.Character:FindFirstChild("Room Pass") and not Player.Backpack:FindFirstChild("Room Pass") then
--- Give card code
end

BE WARY OF YOUR CAPITALIZATION! FindFirstChild is case-sensitive. It will iterate through the children of the given object (in this case, the Player) to find the exact Instance which has the exact name as given in the brackets.

1 Like

If you want to see if no other player has said tool on the other hand, you would have to iterate through each Player and run a FindFirstChild check.

Use an enhanced for loop to iterate through each Player.

for _,Player in pairs(game.Players:GetPlayers()) do
--- code
end
1 Like