ARtemT
Oct 9th, 2022
244
1
Never
This is comment for paste combat warriors script
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local PlayerService = game:GetService("Players")
  3. local RunService = game:GetService("RunService")
  4. local Workspace = game:GetService("Workspace")
  5.  
  6. local MainRemote = ReplicatedStorage.MainRemote
  7. local LocalPlayer = PlayerService.LocalPlayer
  8. local Drops = Workspace.Drops
  9.  
  10. getgenv().ItemPickup = true
  11. getgenv().PickupDistance = 30
  12.  
  13. local GarbageScriptName = utf8.char(71,97,114,98,97,103,101,8203,67,111,100,101)
  14.  
  15. local function GetKey()
  16.    for Index,Func in pairs(getgc()) do
  17.        local FEnv = getfenv(Func)
  18.        if FEnv.script and FEnv.script.Name == GarbageScriptName then
  19.            local UpValues = getupvalues(Func)
  20.            if UpValues[1] then
  21.                if type(UpValues[1]) == "string" then
  22.                    return UpValues[1]
  23.                end
  24.            end
  25.        end
  26.    end
  27. end
  28.  
  29. local function GetItem(Name,RootPart)
  30.    local ClosestItem,Distance = nil,PickupDistance
  31.    for Index,Item in pairs(Drops:GetChildren()) do
  32.        if Item.Name == Name then
  33.            local Magnitude = (RootPart.Position - Item.Position).Magnitude
  34.            if Magnitude < Distance then
  35.                ClosestItem,Distance = Item,Magnitude
  36.            end
  37.        end
  38.    end return ClosestItem
  39. end
  40.  
  41. local Key = GetKey()
  42. local HumanoidRootPart = LocalPlayer.Character
  43. and LocalPlayer.Character:FindFirstChild("Torso")
  44.  
  45. task.spawn(function()
  46.    while task.wait(1) do
  47.        if ItemPickup then Key = GetKey()
  48.            HumanoidRootPart = LocalPlayer.Character
  49.            and LocalPlayer.Character:FindFirstChild("Torso")
  50.        end
  51.    end
  52. end)
  53.  
  54. RunService.RenderStepped:Connect(function()
  55.    if ItemPickup and HumanoidRootPart and Key then
  56.        local Item = GetItem("Candy",HumanoidRootPart)
  57.        if Item then MainRemote:FireServer(Key.."ac","us",Item) end
  58.    end
  59. end)
Add Comment
Please, Sign In to add comment