local UT = game.Players.LocalPlayer.Backpack:findFirstChild("Tool").UtilityTag
if UT == nil then --IDK what I'm actually doing but I'm just trying to see if that player's tool has the tag (it's a frame).
print("true")
else
print("false")
end
✓ ANSWER ACCEPTED
How to see if a player has a tool with a tag and delete others?
2 answers
✓ Accepted answer
Assuming I read your question right, you can't use Tool as what you are looking for, you need to check if the class is a tool, but finding tool would be too much for the server because there might be more than one tool. You should use this script:
for i, v in pairs(game.Players.LocalPlayer.Backpack:GetChildren())
if v:IsA("Tool") do
if not v:FindFirstChild("UtilityTag") then
v:Destroy()
end
end
end
What that means in English is
check everything inside the local player's backpack, if the part we are checking is a tool, then if you can't find a utility tag, then destroy it.
Hope I helped.
Thanks @cmgtotalyawesome there were a few errors in your script through.
for i, v in pairs(game.Players.LocalPlayer.Backpack:GetChildren()) --Needed a ")"
do if v:IsA("Tool") then --"Do" needed apparently
if not v:FindFirstChild("UtilityTag") then
v:Destroy()
end
end
end --No ")" needed.
Thanks btw! :D
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
sorry, I was doing functions all day and got used to just 3 parentheses and a parentheses around the last end xD