Advertisement
Trey4321

Egg Packing Tycoon

Jul 3rd, 2022 (edited)
1,349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. getgenv().keybind_autofarm = "g"
  2. getgenv().autofarm = false
  3.  
  4. local plr = game.Players.LocalPlayer
  5. local remotes = game:GetService("ReplicatedStorage").RemoteEvents
  6. local plot = nil
  7.  
  8. for _,part in pairs(workspace.PlotsFolder:GetDescendants()) do
  9.     if part.Name == "PlayerName" then
  10.         if string.find(part.Text, plr.DisplayName or plr.Name) then
  11.             plot = part.Parent.Parent.Parent.Parent
  12.         end
  13.     end
  14. end
  15.  
  16. plr:GetMouse().KeyDown:Connect(function(key)
  17.     if key:lower() == keybind_autofarm then
  18.         autofarm = not autofarm
  19.     end
  20. end)
  21.  
  22. game:GetService("RunService").Stepped:Connect(function()
  23.     wait()
  24.     pcall(function()
  25.         if autofarm then
  26.             for _,egg in pairs(workspace._EggFolder:GetChildren()) do
  27.                 remotes.EggEvent:FireServer({[egg:GetAttribute("ID")] = 1})
  28.                 egg:Destroy()
  29.             end
  30.             if tonumber(plr.PlayerGui.MainUI.InfoBar.Sidebar.Eggs.Eggs.Text) > 0 then
  31.                 remotes.ProximityPromptEvent:FireServer("AddToMachine")
  32.             end
  33.             for _,part in pairs(plot.BuyPads:GetDescendants()) do
  34.                 if autofarm == false then break end
  35.                 if part:IsA("BillboardGui") then
  36.                     local touch = part.Parent.TouchInterest
  37.                     if plr.leaderstats.Coins.Value >= tonumber(part.Cost.Text:split('$')[2]) then
  38.                         plr.Character.HumanoidRootPart.CFrame = part.Parent.CFrame
  39.                     end
  40.                 end
  41.                 wait()
  42.             end
  43.             remotes.ProximityPromptEvent:FireServer("Rebirth")
  44.         end
  45.     end)
  46. end)
  47.  
  48. -- Anti Afk --
  49. local vu = game:GetService("VirtualUser")
  50. plr.Idled:Connect(function()
  51.     vu:Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  52.     wait(1)
  53.     vu:Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  54. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement