local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local LocalPlayer = Players.LocalPlayer local scriptActive = true local farming = false local totalCollected = 0 local Actionable = ReplicatedStorage.Shared.Universe.Network.RemoteEvent.Actionable local idMin = 1300 local idMax = 9000 local function getSack() local c = LocalPlayer.Character return c and c:FindFirstChild("Sack") end local function getSackCount() local sack = getSack() if not sack then return 0 end local bb = sack:FindFirstChildWhichIsA("BillboardGui") if not bb then return 0 end local tl = bb:FindFirstChildWhichIsA("TextLabel") if not tl then return 0 end local num = tl.Text:match("^(%d+)") return tonumber(num) or 0 end local function waitSackIncrease(before, timeout) local t = tick() while tick() - t < timeout do if not farming then return false end if getSackCount() > before then return true end task.wait(0.02) end return false end local function waitSackDecrease(before, timeout) local t = tick() while tick() - t < timeout do if not farming then return false end if getSackCount() < before then return true end task.wait(0.02) end return false end local screenGui = Instance.new("ScreenGui") screenGui.Name = "DRAutoFarm" screenGui.ResetOnSpawn = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling if syn and syn.protect_gui then syn.protect_gui(screenGui) screenGui.Parent = game.CoreGui elseif gethui then screenGui.Parent = gethui() else screenGui.Parent = game.CoreGui end local MENU_W = 200 local MENU_H = 52 local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, MENU_W, 0, MENU_H) mainFrame.Position = UDim2.new(0.04, 0, 0.25, 0) mainFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 45) mainFrame.BorderSizePixel = 1 mainFrame.BorderColor3 = Color3.fromRGB(85, 85, 85) mainFrame.Parent = screenGui local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 24) titleBar.BackgroundColor3 = Color3.fromRGB(33, 33, 33) titleBar.BorderSizePixel = 0 titleBar.Parent = mainFrame local titleLbl = Instance.new("TextLabel") titleLbl.Size = UDim2.new(1, -52, 1, 0) titleLbl.Position = UDim2.new(0, 6, 0, 0) titleLbl.BackgroundTransparency = 1 titleLbl.Text = "Dead Rails AutoFarm" titleLbl.TextColor3 = Color3.fromRGB(195, 195, 195) titleLbl.TextSize = 11 titleLbl.Font = Enum.Font.Code titleLbl.TextXAlignment = Enum.TextXAlignment.Left titleLbl.Parent = titleBar local minBtn = Instance.new("TextButton") minBtn.Size = UDim2.new(0, 24, 0, 24) minBtn.Position = UDim2.new(1, -48, 0, 0) minBtn.BackgroundTransparency = 1 minBtn.Text = "-" minBtn.TextColor3 = Color3.fromRGB(180, 180, 180) minBtn.TextSize = 20 minBtn.Font = Enum.Font.Code minBtn.BorderSizePixel = 0 minBtn.Parent = titleBar local clsBtn = Instance.new("TextButton") clsBtn.Size = UDim2.new(0, 24, 0, 24) clsBtn.Position = UDim2.new(1, -24, 0, 0) clsBtn.BackgroundTransparency = 1 clsBtn.Text = "x" clsBtn.TextColor3 = Color3.fromRGB(180, 180, 180) clsBtn.TextSize = 14 clsBtn.Font = Enum.Font.Code clsBtn.BorderSizePixel = 0 clsBtn.Parent = titleBar local cf = Instance.new("Frame") cf.Size = UDim2.new(1, 0, 1, -24) cf.Position = UDim2.new(0, 0, 0, 24) cf.BackgroundTransparency = 1 cf.Parent = mainFrame local farmBtn = Instance.new("TextButton") farmBtn.Size = UDim2.new(1, -12, 0, 22) farmBtn.Position = UDim2.new(0, 6, 0, 3) farmBtn.BackgroundColor3 = Color3.fromRGB(55, 55, 55) farmBtn.BorderSizePixel = 1 farmBtn.BorderColor3 = Color3.fromRGB(88, 88, 88) farmBtn.Text = "Start AutoFarm" farmBtn.TextColor3 = Color3.fromRGB(200, 200, 200) farmBtn.TextSize = 12 farmBtn.Font = Enum.Font.Code farmBtn.Parent = cf farmBtn.MouseEnter:Connect(function() farmBtn.BackgroundColor3 = Color3.fromRGB(70,70,70) end) farmBtn.MouseLeave:Connect(function() farmBtn.BackgroundColor3 = Color3.fromRGB(55,55,55) end) minBtn.MouseEnter:Connect(function() minBtn.TextColor3 = Color3.fromRGB(240,240,240) end) minBtn.MouseLeave:Connect(function() minBtn.TextColor3 = Color3.fromRGB(180,180,180) end) clsBtn.MouseEnter:Connect(function() clsBtn.TextColor3 = Color3.fromRGB(220,50,50) end) clsBtn.MouseLeave:Connect(function() clsBtn.TextColor3 = Color3.fromRGB(180,180,180) end) local isMin = false minBtn.MouseButton1Click:Connect(function() isMin = not isMin cf.Visible = not isMin mainFrame.Size = isMin and UDim2.new(0,MENU_W,0,24) or UDim2.new(0,MENU_W,0,MENU_H) end) clsBtn.MouseButton1Click:Connect(function() scriptActive = false farming = false screenGui:Destroy() end) local drag, ds, sp = false, nil, nil titleBar.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 then drag = true ds = i.Position sp = mainFrame.Position end end) titleBar.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 then drag = false end end) UserInputService.InputChanged:Connect(function(i) if drag and i.UserInputType == Enum.UserInputType.MouseMovement then local d = i.Position - ds mainFrame.Position = UDim2.new(sp.X.Scale, sp.X.Offset+d.X, sp.Y.Scale, sp.Y.Offset+d.Y) end end) farmBtn.MouseButton1Click:Connect(function() if not scriptActive then return end if farming then farming = false farmBtn.Text = "Start AutoFarm" return end farming = true totalCollected = 0 farmBtn.Text = "Stop AutoFarm" task.spawn(function() while scriptActive and farming do local countBefore = getSackCount() for id = idMin, idMax do if not scriptActive or not farming then break end pcall(function() Actionable:FireServer(id) end) if not farming then break end local picked = waitSackIncrease(countBefore, 0.08) if picked then totalCollected = totalCollected + 1 countBefore = getSackCount() if not farming then break end waitSackDecrease(countBefore, 1.5) if not farming then break end countBefore = getSackCount() end task.wait(0.02) end if not farming then break end task.wait(0.5) end farming = false farmBtn.Text = "Start AutoFarm" end) end) LocalPlayer.CharacterAdded:Connect(function() task.wait(1) farming = false farmBtn.Text = "Start AutoFarm" end)