local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") local runService = game:GetService("RunService") local starterGui = game:GetService("StarterGui") local enabled = false -- Toggle state local lastCollectionTime = 0 local lastSellTime = 0 local platform = nil -- Reference to the platform under the player -- Create GUI local function createGui() local screenGui = Instance.new("ScreenGui") screenGui.Name = "AutomationGui" screenGui.ResetOnSpawn = false -- Prevent GUI from disappearing after reset screenGui.Parent = player.PlayerGui local toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.new(0, 200, 0, 50) toggleButton.Position = UDim2.new(0.5, -100, 0.8, 0) toggleButton.Text = "Start Automation" toggleButton.BackgroundColor3 = Color3.fromRGB(0, 170, 0) toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) toggleButton.Parent = screenGui local closeButton = Instance.new("TextButton") closeButton.Size = UDim2.new(0, 30, 0, 30) closeButton.Position = UDim2.new(1, -35, 0, 5) closeButton.Text = "X" closeButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0) closeButton.TextColor3 = Color3.fromRGB(255, 255, 255) closeButton.Parent = screenGui toggleButton.MouseButton1Click:Connect(function() enabled = not enabled if enabled then toggleButton.Text = "Stop Automation" toggleButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0) else toggleButton.Text = "Start Automation" toggleButton.BackgroundColor3 = Color3.fromRGB(0, 170, 0) end end) closeButton.MouseButton1Click:Connect(function() screenGui:Destroy() end) end -- Call createGui if the GUI doesn't already exist if not player.PlayerGui:FindFirstChild("AutomationGui") then createGui() end -- Function to find valid WheatNodes across both WheatPlots local function findClickInValidWheatNodes() local validClickParts = {} for _, wheatPlot in ipairs(workspace:GetDescendants()) do if wheatPlot:IsA("Model") and wheatPlot.Name == "WheatPlot" then for _, wheatNode in ipairs(wheatPlot:GetChildren()) do if wheatNode:IsA("Model") and wheatNode.Name == "WheatNode" then local growth = wheatNode:GetAttribute("Growth") local isAlive = wheatNode:GetAttribute("IsAlive") if growth == 30 and isAlive then local stage4 = wheatNode:FindFirstChild("Stage4") if stage4 then local click = stage4:FindFirstChild("Click") if click then table.insert(validClickParts, click) end end end end end end end return validClickParts end -- Lightweight Function to fire TouchInterest on both GrainStock models local function fireTouchInterestInGrainStocks() local grainStocks = {} for _, obj in ipairs(workspace:GetChildren()) do if obj:IsA("Model") and obj.Name == "GrainStock" then table.insert(grainStocks, obj) end end for _, grainStock in ipairs(grainStocks) do local sellPart = grainStock:FindFirstChild("Sell") if sellPart and sellPart:IsA("BasePart") then firetouchinterest(humanoidRootPart, sellPart, 0) -- Simulate touch start firetouchinterest(humanoidRootPart, sellPart, 1) -- Simulate touch end end end end -- Function to create the platform under the player local function createPlatformUnderPlayer(position) if platform then platform:Destroy() -- Remove existing platform if it exists end -- Create a new platform 8 studs below the player's position platform = Instance.new("Part") platform.Size = Vector3.new(10, 1, 10) -- Adjust platform size platform.Position = position - Vector3.new(0, 8, 0) -- 8 studs below platform.Anchored = true platform.CanCollide = true platform.BrickColor = BrickColor.new("Bright blue") -- Change platform color platform.Parent = workspace end -- Main Automation Logic runService.Heartbeat:Connect(function() if not enabled then return end local currentTime = tick() -- Collect Wheat (every 0.3 seconds) if currentTime - lastCollectionTime >= 0.3 then lastCollectionTime = currentTime local targetLocations = findClickInValidWheatNodes() for _, clickPart in ipairs(targetLocations) do -- Teleport under the 'Click' part, 8 units below it local newPosition = clickPart.Position + Vector3.new(0, -12, 0) humanoidRootPart.CFrame = CFrame.new(newPosition) -- Teleport to position 8 studs below -- Immediately fire touch interest after teleporting local attachment = clickPart:FindFirstChild("Attachment") if attachment then local proximityPrompt = attachment:FindFirstChild("ProximityPrompt") if proximityPrompt then fireproximityprompt(proximityPrompt) end end -- Create platform under the player after teleporting (no delay) createPlatformUnderPlayer(newPosition) end end -- Sell Wheat (fire touch interest every 0.05 seconds for faster response) if currentTime - lastSellTime >= 0.05 then lastSellTime = currentTime fireTouchInterestInGrainStocks() -- Fire touch interest for both GrainStocks end end)