local Players = game:GetService('Players') local ReplicatedStorage = game:GetService('ReplicatedStorage') local UserInputService = game:GetService('UserInputService') local Debris = game:GetService('Debris') local player = Players.LocalPlayer local PlayerGui = player:WaitForChild('PlayerGui') local SAPLING_NAME = 'sapling' local SHOW_BLUEPRINT = true local MARKER_LIFETIME = 6 local START_CFRAME = CFrame.new( -1.29994965, 1.99994278, -1.50001144, -0.249999881, 0.432982802, 0.866040468, 0.865997314, 0.500048637, -1.5437603e-05, -0.43306911, 0.74998486, -0.499974132 ) local PLANT_SPACING = 10 -- studs between each tree local PLANT_DISTANCE = 44 -- circle radius local PLANT_TIME = 6 -- delay (x/100 seconds) local function findPlantRemote() if ReplicatedStorage:FindFirstChild('RemoteEvents') then local r = ReplicatedStorage.RemoteEvents:FindFirstChild('RequestPlantItem') if r then return r end end local r = ReplicatedStorage:FindFirstChild('RequestPlantItem') if r then return r end for _, obj in ipairs(ReplicatedStorage:GetDescendants()) do if obj.Name:lower() == 'requestplantitem' then return obj end end return nil end local PlantRemote = findPlantRemote() local function findSaplingInstance() local items = workspace:FindFirstChild('Items') if items then for _, c in ipairs(items:GetChildren()) do if c.Name:lower():find(SAPLING_NAME:lower()) then return c end end end for _, c in ipairs(ReplicatedStorage:GetDescendants()) do if (c:IsA('Model') or c:IsA('Tool')) and c.Name:lower():find(SAPLING_NAME:lower()) then return c end end for _, cont in ipairs({player:FindFirstChild('Backpack'), player:FindFirstChild('Inventory')}) do if cont then for _, c in ipairs(cont:GetChildren()) do if c.Name:lower():find(SAPLING_NAME:lower()) then return c end end end end return nil end local function getGroundY(xzPos, defaultY) local origin = Vector3.new(xzPos.X, (defaultY or xzPos.Y) + 50, xzPos.Z) local rp = RaycastParams.new() rp.FilterDescendantsInstances = {player.Character or player} rp.FilterType = Enum.RaycastFilterType.Blacklist local res = workspace:Raycast(origin, Vector3.new(0, -200, 0), rp) if res and res.Position then return res.Position.Y end return defaultY or xzPos.Y end local function createMarker(pos) if not SHOW_BLUEPRINT then return end local p = Instance.new('Part') p.Size = Vector3.new(1,1,1) p.Anchored = true p.CanCollide = false p.Transparency = 0.45 p.Color = Color3.fromRGB(45, 200, 45) p.Name = 'SaplingMarker' p.CFrame = CFrame.new(pos + Vector3.new(0, 0.5, 0)) p.Parent = workspace Debris:AddItem(p, MARKER_LIFETIME) end local function tryCallRemote(remote, argTable) if not remote then return false end local ok = pcall(function() if remote.ClassName == 'RemoteFunction' then remote:InvokeServer(unpack(argTable)) else remote:FireServer(unpack(argTable)) end end) return ok end local function robustPlantCall(remote, saplingArg, position) if not remote then return false end for _, args in ipairs({ {saplingArg, position}, {position, saplingArg}, {tostring(saplingArg), position}, {position, tostring(saplingArg)} }) do if tryCallRemote(remote, args) then return true end task.wait(0.03) end return false end local function plantCircle(centerPos, distance) local firstArg = findSaplingInstance() or SAPLING_NAME -- derive count from radius + spacing so trees are evenly spread local circumference = 2 * math.pi * distance local count = math.max(1, math.floor(circumference / PLANT_SPACING)) for i = 1, count do local angle = (2 * math.pi / count) * (i - 1) local x = centerPos.X + math.cos(angle) * distance local z = centerPos.Z + math.sin(angle) * distance local finalPos = Vector3.new(x, getGroundY(Vector3.new(x, centerPos.Y, z), centerPos.Y), z) createMarker(finalPos) robustPlantCall(PlantRemote, firstArg, finalPos) task.wait(PLANT_TIME / 100) end end local function plantFromStart() plantCircle(START_CFRAME.Position, PLANT_DISTANCE) end local autoPlant = false local planting = false local function togglePlanting() autoPlant = not autoPlant if autoPlant and not planting then planting = true task.spawn(function() while autoPlant do plantFromStart() task.wait(0.5) end planting = false end) end end -- ══════════════════════════════════════════ -- GUI -- ══════════════════════════════════════════ local screenGui = Instance.new('ScreenGui') screenGui.Name = 'AutoPlantGui' screenGui.ResetOnSpawn = false screenGui.Parent = PlayerGui local TITLE_H = 40 local PAD_TOP = 16 local SLIDER_H = 44 local PAD_MID = 18 local BTN_H = 44 local PAD_BTN = 10 local STATUS_H = 20 local PAD_BOT = 14 local TOTAL_H = TITLE_H + PAD_TOP + SLIDER_H*3 + PAD_MID + BTN_H + PAD_BTN + STATUS_H + PAD_BOT local frame = Instance.new('Frame') frame.Size = UDim2.new(0, 230, 0, TOTAL_H) frame.Position = UDim2.new(0.05, 0, 0.25, 0) frame.BackgroundColor3 = Color3.fromRGB(28, 28, 28) frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true frame.Parent = screenGui Instance.new('UICorner', frame).CornerRadius = UDim.new(0, 12) local title = Instance.new('TextLabel') title.Size = UDim2.new(1, 0, 0, TITLE_H) title.BackgroundColor3 = Color3.fromRGB(46, 160, 46) title.TextColor3 = Color3.new(1,1,1) title.Text = '🌱 Auto Sapling Planter' title.Font = Enum.Font.GothamBold title.TextSize = 13 title.BorderSizePixel = 0 title.Parent = frame Instance.new('UICorner', title).CornerRadius = UDim.new(0, 12) local divider = Instance.new('Frame') divider.Size = UDim2.new(1, 0, 0, 2) divider.Position = UDim2.new(0, 0, 0, TITLE_H) divider.BackgroundColor3 = Color3.fromRGB(46, 160, 46) divider.BorderSizePixel = 0 divider.Parent = frame -- ── Slider factory ──────────────────────────────────────────── local function makeSlider(labelText, minVal, maxVal, defaultVal, yPos, displayFn, onChange) displayFn = displayFn or tostring local label = Instance.new('TextLabel') label.Size = UDim2.new(1, -20, 0, 18) label.Position = UDim2.new(0, 10, 0, yPos) label.BackgroundTransparency = 1 label.TextColor3 = Color3.fromRGB(210, 210, 210) label.Text = labelText .. ': ' .. displayFn(defaultVal) label.Font = Enum.Font.GothamSemibold label.TextSize = 12 label.TextXAlignment = Enum.TextXAlignment.Left label.Parent = frame local track = Instance.new('Frame') track.Size = UDim2.new(1, -20, 0, 8) track.Position = UDim2.new(0, 10, 0, yPos + 22) track.BackgroundColor3 = Color3.fromRGB(55, 55, 55) track.BorderSizePixel = 0 track.Parent = frame Instance.new('UICorner', track).CornerRadius = UDim.new(0, 4) local ratio0 = (defaultVal - minVal) / (maxVal - minVal) local fill = Instance.new('Frame') fill.Size = UDim2.new(ratio0, 0, 1, 0) fill.BackgroundColor3 = Color3.fromRGB(70, 195, 70) fill.BorderSizePixel = 0 fill.Parent = track Instance.new('UICorner', fill).CornerRadius = UDim.new(0, 4) local knob = Instance.new('TextButton') knob.Size = UDim2.new(0, 20, 0, 20) knob.AnchorPoint = Vector2.new(0.5, 0.5) knob.Position = UDim2.new(ratio0, 0, 0.5, 0) knob.BackgroundColor3 = Color3.fromRGB(240, 240, 240) knob.Text = '' knob.BorderSizePixel = 0 knob.ZIndex = 5 knob.Parent = track Instance.new('UICorner', knob).CornerRadius = UDim.new(1, 0) local shadow = Instance.new('UIStroke') shadow.Color = Color3.fromRGB(0,0,0) shadow.Thickness = 1 shadow.Transparency = 0.6 shadow.Parent = knob local dragging = false knob.MouseButton1Down:Connect(function() dragging = true end) knob.TouchLongPress:Connect(function() dragging = true end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) UserInputService.InputChanged:Connect(function(input) if not dragging then return end if input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch then return end local r = math.clamp((input.Position.X - track.AbsolutePosition.X) / track.AbsoluteSize.X, 0, 1) local val = math.floor(minVal + r * (maxVal - minVal)) fill.Size = UDim2.new(r, 0, 1, 0) knob.Position = UDim2.new(r, 0, 0.5, 0) label.Text = labelText .. ': ' .. displayFn(val) onChange(val) end) end -- ── 3 sliders ───────────────────────────────────────────────── local s = TITLE_H + PAD_TOP -- 1) Spacing: studs between each tree (2–50) makeSlider('Spacing', 2, 50, PLANT_SPACING, s, function(v) return v .. ' studs' end, function(v) PLANT_SPACING = v end) -- 2) Range: circle radius (5–150) makeSlider('Range', 5, 150, PLANT_DISTANCE, s + SLIDER_H, function(v) return v .. ' studs' end, function(v) PLANT_DISTANCE = v end) -- 3) Time: delay between each plant (1–50 → 0.01s–0.50s) makeSlider('Time', 1, 50, PLANT_TIME, s + SLIDER_H*2, function(v) return string.format('%.2fs', v/100) end, function(v) PLANT_TIME = v end) -- ── Toggle button ───────────────────────────────────────────── local btnY = s + SLIDER_H*3 + PAD_MID local toggleBtn = Instance.new('TextButton') toggleBtn.Size = UDim2.new(1, -20, 0, BTN_H) toggleBtn.Position = UDim2.new(0, 10, 0, btnY) toggleBtn.BackgroundColor3 = Color3.fromRGB(46, 175, 46) toggleBtn.TextColor3 = Color3.new(1,1,1) toggleBtn.Text = '▶ Start Planting' toggleBtn.Font = Enum.Font.GothamBold toggleBtn.TextSize = 14 toggleBtn.BorderSizePixel = 0 toggleBtn.Parent = frame Instance.new('UICorner', toggleBtn).CornerRadius = UDim.new(0, 9) local statusLabel = Instance.new('TextLabel') statusLabel.Size = UDim2.new(1, -20, 0, STATUS_H) statusLabel.Position = UDim2.new(0, 10, 0, btnY + BTN_H + PAD_BTN) statusLabel.BackgroundTransparency = 1 statusLabel.TextColor3 = Color3.fromRGB(130, 130, 130) statusLabel.Text = 'Press Q or tap the button' statusLabel.Font = Enum.Font.Gotham statusLabel.TextSize = 11 statusLabel.Parent = frame local function updateBtn() if autoPlant then toggleBtn.BackgroundColor3 = Color3.fromRGB(200, 55, 55) toggleBtn.Text = '■ Stop Planting' statusLabel.Text = '🟢 Planting in progress…' statusLabel.TextColor3 = Color3.fromRGB(80, 200, 80) else toggleBtn.BackgroundColor3 = Color3.fromRGB(46, 175, 46) toggleBtn.Text = '▶ Start Planting' statusLabel.Text = 'Press Q or tap the button' statusLabel.TextColor3 = Color3.fromRGB(130, 130, 130) end end toggleBtn.MouseButton1Click:Connect(function() togglePlanting() updateBtn() end) UserInputService.InputBegan:Connect(function(input, gpe) if gpe then return end if input.KeyCode == Enum.KeyCode.Q then togglePlanting() updateBtn() end end)