From 0f0f5c0025299b8b1db9c2fbaeb1acff84161033 Mon Sep 17 00:00:00 2001 From: Expertcoderz <81153405+Expertcoderz@users.noreply.github.com> Date: Sat, 4 Dec 2021 22:07:05 +0800 Subject: [PATCH] fix :removetools & :removetool --- MainModule/Server/Commands/Moderators.lua | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index 1bf1e11418..f073f7e94a 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -3798,12 +3798,6 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr: Player, args: {string}) for i, v in pairs(service.GetPlayers(plr, args[1])) do - local backpack = v:FindFirstChildOfClass("Backpack") - if backpack then - for _, tool in pairs(backpack:GetChildren()) do - if tool:IsA("BackpackItem") then tool:Destroy() end - end - end if v.Character then local hum = v.Character:FindFirstChildOfClass("Humanoid") if hum then hum:UnequipTools() end @@ -3811,6 +3805,12 @@ return function(Vargs, env) if tool:IsA("BackpackItem") then tool:Destroy() end end end + local backpack = v:FindFirstChildOfClass("Backpack") + if backpack then + for _, tool in pairs(backpack:GetChildren()) do + if tool:IsA("BackpackItem") then tool:Destroy() end + end + end end end }; @@ -3825,19 +3825,19 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr: Player, args: {string}) for i, v in pairs(service.GetPlayers(plr, args[1])) do - local backpack = v:FindFirstChildOfClass("Backpack") - if backpack then - for _, tool in pairs(backpack:GetChildren()) do + if v.Character then + for _, tool in pairs(v.Character:GetChildren()) do if tool:IsA("BackpackItem") and string.sub(tool.Name:lower(), 1, #args[2])== args[2]:lower() then + local hum = v.Character:FindFirstChildOfClass("Humanoid") + if hum then hum:UnequipTools() end tool:Destroy() end end end - if v.Character then - for _, tool in pairs(v.Character:GetChildren()) do + local backpack = v:FindFirstChildOfClass("Backpack") + if backpack then + for _, tool in pairs(backpack:GetChildren()) do if tool:IsA("BackpackItem") and string.sub(tool.Name:lower(), 1, #args[2])== args[2]:lower() then - local hum = v.Character:FindFirstChildOfClass("Humanoid") - if hum then hum:UnequipTools() end tool:Destroy() end end