Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to check if a player has something equipped thats not specific tool?

Asked by 1 year ago

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

1 answer

Log in to vote
0
Answered by 1 year ago

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
Ad

Answer this question