Advertisement
kill21_2

фарм

May 7th, 2025
1,310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.32 KB | None | 0 0
  1. --// Services
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3. local InsertService = game:GetService("InsertService")
  4. local MarketplaceService = game:GetService("MarketplaceService")
  5. local Players = game:GetService("Players")
  6. local RunService = game:GetService("RunService")
  7.  
  8. local LocalPlayer = Players.LocalPlayer
  9. local Leaderstats = LocalPlayer.leaderstats
  10. local Backpack = LocalPlayer.Backpack
  11. local PlayerGui = LocalPlayer.PlayerGui
  12.  
  13. local ShecklesCount = Leaderstats.Sheckles
  14. local GameInfo = MarketplaceService:GetProductInfo(game.PlaceId)
  15.  
  16. --// ReGui
  17. local ReGui = loadstring(game:HttpGet('https://raw.githubusercontent.com/depthso/Dear-ReGui/refs/heads/main/ReGui.lua'))()
  18. local PrefabsId = "rbxassetid://" .. ReGui.PrefabsId
  19.  
  20. --// Folders
  21. local GameEvents = ReplicatedStorage.GameEvents
  22. local Farms = workspace.Farm
  23.  
  24. local Accent = {
  25. DarkGreen = Color3.fromRGB(45, 95, 25),
  26. Green = Color3.fromRGB(1, 1, 1),
  27. Brown = Color3.fromRGB(43, 33, 13),
  28. }
  29.  
  30. --// ReGui configuration (Ui library)
  31. ReGui:Init({
  32. Prefabs = InsertService:LoadLocalAsset(PrefabsId)
  33. })
  34. ReGui:DefineTheme("GardenTheme", {
  35. WindowBg = Accent.Brown,
  36. TitleBarBg = Accent.DarkGreen,
  37. TitleBarBgActive = Accent.Green,
  38. ResizeGrab = Accent.DarkGreen,
  39. FrameBg = Accent.DarkGreen,
  40. FrameBgActive = Accent.Green,
  41. CollapsingHeaderBg = Accent.Green,
  42. ButtonsBg = Accent.Green,
  43. CheckMark = Accent.Green,
  44. SliderGrab = Accent.Green,
  45. })
  46.  
  47. --// Globals
  48. local AutoWalk, AutoWalkAllowRandom, NoClip, AutoWalkStatus
  49.  
  50. local function CreateWindow()
  51. local Window = ReGui:Window({
  52. Title = `{GameInfo.Name} | 1QLUA`,
  53. Theme = "GardenTheme",
  54. Size = UDim2.fromOffset(300, 200)
  55. })
  56. return Window
  57. end
  58.  
  59. local function GetFarms()
  60. return Farms:GetChildren()
  61. end
  62.  
  63. local function GetFarmOwner(Farm: Folder): string
  64. local Important = Farm.Important
  65. local Data = Important.Data
  66. local Owner = Data.Owner
  67.  
  68. return Owner.Value
  69. end
  70.  
  71. local function GetFarm(PlayerName: string): Folder?
  72. local Farms = GetFarms()
  73. for _, Farm in next, Farms do
  74. local Owner = GetFarmOwner(Farm)
  75. if Owner == PlayerName then
  76. return Farm
  77. end
  78. end
  79. return
  80. end
  81.  
  82. local MyFarm = GetFarm(LocalPlayer.Name)
  83. local MyImportant = MyFarm.Important
  84. local PlantLocations = MyImportant.Plant_Locations
  85. local PlantsPhysical = MyImportant.Plants_Physical
  86.  
  87. local Dirt = PlantLocations:FindFirstChildOfClass("Part")
  88.  
  89. local function GetArea(Base: BasePart)
  90. local Center = Base:GetPivot()
  91. local Size = Base.Size
  92.  
  93. --// Bottom left
  94. local X1 = math.ceil(Center.X - (Size.X/2))
  95. local Z1 = math.ceil(Center.Z - (Size.Z/2))
  96.  
  97. --// Top right
  98. local X2 = math.floor(Center.X + (Size.X/2))
  99. local Z2 = math.floor(Center.Z + (Size.Z/2))
  100.  
  101. return X1, Z1, X2, Z2
  102. end
  103.  
  104. local X1, Z1, X2, Z2 = GetArea(Dirt)
  105.  
  106. local function GetRandomFarmPoint(): Vector3
  107. local FarmLands = PlantLocations:GetChildren()
  108. local FarmLand = FarmLands[math.random(1, #FarmLands)]
  109.  
  110. local X1, Z1, X2, Z2 = GetArea(FarmLand)
  111. local X = math.random(X1, X2)
  112. local Z = math.random(Z1, Z2)
  113.  
  114. return Vector3.new(X, 4, Z)
  115. end
  116.  
  117. local function CanHarvest(Plant): boolean?
  118. local Prompt = Plant:FindFirstChild("ProximityPrompt", true)
  119. if not Prompt then return end
  120. if not Prompt.Enabled then return end
  121.  
  122. return true
  123. end
  124.  
  125. local function CollectHarvestable(Parent, Plants, IgnoreDistance: boolean?)
  126. local Character = LocalPlayer.Character
  127. local PlayerPosition = Character:GetPivot().Position
  128.  
  129. for _, Plant in next, Parent:GetChildren() do
  130. --// Fruits
  131. local Fruits = Plant:FindFirstChild("Fruits")
  132. if Fruits then
  133. CollectHarvestable(Fruits, Plants, IgnoreDistance)
  134. end
  135.  
  136. --// Distance check
  137. local PlantPosition = Plant:GetPivot().Position
  138. local Distance = (PlayerPosition-PlantPosition).Magnitude
  139. if not IgnoreDistance and Distance > 15 then continue end
  140.  
  141. --// Collect
  142. if CanHarvest(Plant) then
  143. table.insert(Plants, Plant)
  144. end
  145. end
  146. return Plants
  147. end
  148.  
  149. local function GetHarvestablePlants(IgnoreDistance: boolean?)
  150. local Plants = {}
  151. CollectHarvestable(PlantsPhysical, Plants, IgnoreDistance)
  152. return Plants
  153. end
  154.  
  155. local function AutoWalkLoop()
  156. local Character = LocalPlayer.Character
  157. if not Character then return end
  158. local Humanoid = Character:FindFirstChild("Humanoid")
  159. if not Humanoid then return end
  160.  
  161. local Plants = GetHarvestablePlants(true)
  162. local RandomAllowed = AutoWalkAllowRandom.Value
  163. local DoRandom = #Plants == 0 or math.random(1, 3) == 2
  164.  
  165. --// Random point
  166. if RandomAllowed and DoRandom then
  167. local Position = GetRandomFarmPoint()
  168. Humanoid:MoveTo(Position)
  169. AutoWalkStatus.Text = "Random point"
  170. return
  171. end
  172.  
  173. --// Move to each plant
  174. for _, Plant in next, Plants do
  175. local Position = Plant:GetPivot().Position
  176. Humanoid:MoveTo(Position)
  177. AutoWalkStatus.Text = Plant.Name
  178. end
  179. end
  180.  
  181. local function NoclipLoop()
  182. local Character = LocalPlayer.Character
  183. if not NoClip.Value then return end
  184. if not Character then return end
  185.  
  186. for _, Part in Character:GetDescendants() do
  187. if Part:IsA("BasePart") then
  188. Part.CanCollide = false
  189. end
  190. end
  191. end
  192.  
  193. local function MakeLoop(Toggle, Func)
  194. coroutine.wrap(function()
  195. while wait(.01) do
  196. if not Toggle.Value then continue end
  197. Func()
  198. end
  199. end)()
  200. end
  201.  
  202. local function StartServices()
  203. --// Auto-Walk
  204. MakeLoop(AutoWalk, function()
  205. AutoWalkLoop()
  206. wait(1)
  207. end)
  208.  
  209. --// Noclip
  210. RunService.Stepped:Connect(NoclipLoop)
  211. end
  212.  
  213. --// Window
  214. local Window = CreateWindow()
  215.  
  216. --// Auto-Walk
  217. local WallNode = Window:TreeNode({Title="Auto-FARM"})
  218. AutoWalkStatus = WallNode:Label({
  219. Text = "None"
  220. })
  221. AutoWalk = WallNode:Checkbox({
  222. Value = false,
  223. Label = "Enabled"
  224. })
  225. AutoWalkAllowRandom = WallNode:Checkbox({
  226. Value = true,
  227. Label = "Allow random points"
  228. })
  229. NoClip = WallNode:Checkbox({
  230. Value = false,
  231. Label = "NoClip"
  232. })
  233.  
  234. --// Start services
  235. StartServices()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement