how do i check if a player has a tool equipped roblox like any tool not a specific tool cause i can check if a specific tool is equipped
COMMUNITY QUESTION
Is there a way to check if a player has something equipped thats not specific tool?
1 answer
You can check if then player's character has a tool inside of it, because if you parent a tool inside a humanoid (any model that has limbs and the Humanoid instance like the player's character) it will automatically make that humanoid equip it.
local Players = game:GetService("Players")
local Player = Players.PlayerAdded:Wait() -- waits until the player joined the game
local Character = Player.Character or Player.CharacterAdded:Wait() -- waits until the player's character finished loading
while task.wait(1) do -- creates a "while true do" loop that loops every 1 second
local Tool = Character:FindFirstChildWhichIsA("Tool")
if Tool ~= nil then -- if a tool has been found inside the character
print("Player caught holding a tool!")
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
