local player = game:GetService("Players").LocalPlayer local UIS = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local ScreenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui")) ScreenGui.Name = "AutoFarmGUI" ScreenGui.ResetOnSpawn = false local Button = Instance.new("TextButton", ScreenGui) Button.Size = UDim2.new(0, 140, 0, 45) Button.Position = UDim2.new(0.05, 0, 0.3, 0) Button.Text = "Auto Farm: OFF" Button.BackgroundColor3 = Color3.fromRGB(255, 70, 70) Button.TextScaled = true Button.Active = true local autoFarm = false local dragging = false local dragStart local startPosButton local function update(input) local delta = input.Position - dragStart Button.Position = UDim2.new( startPosButton.X.Scale, startPosButton.X.Offset + delta.X, startPosButton.Y.Scale, startPosButton.Y.Offset + delta.Y ) end local function dragBegin(input) dragging = true dragStart = input.Position startPosButton = Button.Position end local function dragEnd(input) dragging = false end Button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragBegin(input) end end) Button.InputEnded:Connect(dragEnd) UIS.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then update(input) end end) local function getNearestRoot() local nearest local minDistance = math.huge local char = player.Character if not char or not char:FindFirstChild("HumanoidRootPart") then return nil end local hrp = char.HumanoidRootPart for _, sea in ipairs(workspace.WorldSea:GetChildren()) do for _, fish in ipairs(sea:GetChildren()) do if fish:FindFirstChild("Model") and fish.Model:FindFirstChild("Root") then local root = fish.Model.Root local dist = (root.Position - hrp.Position).Magnitude if dist < minDistance then minDistance = dist nearest = root end end end end return nearest end local function tweenToRoot(root) local char = player.Character if not char or not char:FindFirstChild("HumanoidRootPart") then return end local hrp = char.HumanoidRootPart local distance = (root.Position - hrp.Position).Magnitude local tweenInfo = TweenInfo.new( distance / 60, Enum.EasingStyle.Linear ) local tween = TweenService:Create(hrp, tweenInfo, { CFrame = CFrame.new(root.Position) }) tween:Play() return tween end local function findTool() local char = player.Character if not char then return nil end for _, item in ipairs(char:GetChildren()) do if item:IsA("Tool") then return item end end return nil end local function autoCast(root) if not root then return end local tool = findTool() if not tool then return end local args = { [1] = "Fire", [2] = { cameraOrigin = workspace.CurrentCamera.CFrame.Position, player = player, toolInstance = tool, destination = root.Position, isCharge = false } } game:GetService("ReplicatedStorage").Remotes.FireRE:FireServer(unpack(args)) end task.spawn(function() while true do if autoFarm then local root = getNearestRoot() if root then tweenToRoot(root) task.wait(0.2) autoCast(root) end end task.wait(0.03) end end) Button.MouseButton1Click:Connect(function() autoFarm = not autoFarm if autoFarm then Button.Text = "Auto Farm: ON" Button.BackgroundColor3 = Color3.fromRGB(70, 255, 70) else Button.Text = "Auto Farm: OFF" Button.BackgroundColor3 = Color3.fromRGB(255, 70, 70) end end)