Trying to make a custom admin command for removing tools. The part that’s not working is when trying to remove a tool from everyone.
Commands.removetool = function(admin,player,tool)
if player then
if player == "all" then
player = game.Players:GetChildren()
tool = player.Backpack:FindFirstChild(tool) -- this is where the error is
print(admin.Name.." has removed "..tool.Name.." from "..player.Name)
if player and tool then
tool:Destory()
end
else do
player = game.Players:FindFirstChild(player)
tool = player.Backpack:FindFirstChild(tool)
print(admin.Name.." has removed "..tool.Name.." from "..player.Name)
if player and tool then
tool:Destory()
end
end
end
end
end
return Commands