Advertisement
Honansik

Project Delt Auto Loot Script

Mar 19th, 2022
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.17 KB | None | 0 0
  1. local ItemToSearchFor = "AKM" -- Item you want
  2. local BlacklistedNames = {"Stock", "Front", "Handle", "Hider", "Brake"} -- Blacklisted Items
  3.  
  4. function IsBlacklisted(Name)
  5.    local Pass = false
  6.    
  7.    for NameIndex,BlacklistedName in pairs(BlacklistedNames) do
  8.        if Name:lower():find(BlacklistedName:lower()) then
  9.           Pass = true
  10.           break
  11.        end
  12.    end
  13.    
  14.    return Pass
  15. end
  16.  
  17. local Module = require(game.Players.LocalPlayer.PlayerGui.MainGui.Modules.InventoryFunctions)
  18. local InventoriesSearched = {}
  19. for _,v in next, workspace:GetDescendants() do
  20.    if v:IsA("StringValue") and v.Name:lower():find(ItemToSearchFor:lower()) and IsBlacklisted(v.Name) == false and v.Parent.Name == "Inventory" and not (InventoriesSearched[v.Parent.Parent] or InventoriesSearched[v.Parent.Parent.Parent.Parent]) then
  21.        local ObjectToLoot = v.Parent.Parent
  22.        if ObjectToLoot:IsA("Model") then else
  23.            ObjectToLoot = ObjectToLoot.Parent.Parent
  24.        end
  25.        
  26.        InventoriesSearched[ObjectToLoot] = true
  27.        
  28.        if ObjectToLoot.PrimaryPart then
  29.            if not game.Players:GetPlayerFromCharacter(ObjectToLoot) then
  30.                Module.self.GameplayVariables.CurrentContainer.Value = ObjectToLoot
  31.                game:GetService("ReplicatedStorage").Remotes.Loot:InvokeServer(Module.self.GameplayVariables.CurrentContainer.Value, game.Players.LocalPlayer.Character.PrimaryPart.Position)
  32.                Module:ToggleBackpack(true, true)
  33.                
  34.                wait(0.5)
  35.                
  36.                for _,Cont in next, game.Players.LocalPlayer.PlayerGui.MainGui.MainFrame.BackpackFrame.Loot.Inventory.ScrollingFrame:GetDescendants() do
  37.                    if Cont.Name == "Item" and Cont:IsA("ObjectValue") and Cont.Value and Cont.Value.Name:lower():find(ItemToSearchFor:lower()) and IsBlacklisted(Cont.Value.Name) == false then
  38.                        game:GetService("ReplicatedStorage").Remotes.QuickLoot:FireServer(Cont.Parent.Name)
  39.                    end
  40.                end
  41.                
  42.                wait(0.5)
  43.                game:GetService("ReplicatedStorage").Remotes.Loot:InvokeServer(nil)
  44.            end
  45.        end
  46.    end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement