local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local Event = workspace.ItemBoughtFromShop --// SETTINGS local PINE_PRICE = 80 local points = { {Vector3.new(50, 60, 1376), 2.5}, {Vector3.new(50, 60, 2127), 2.5}, {Vector3.new(50, 60, 2898), 2.5}, {Vector3.new(50, 60, 3667), 2.5}, {Vector3.new(50, 60, 4433), 2.5}, {Vector3.new(50, 60, 5982), 2.5}, {Vector3.new(50, 60, 6749), 2.5}, {Vector3.new(50, 60, 7516), 2.5}, -- Final point unchanged {Vector3.new(-60, -362, 9490), 5}, } local WAIT_AFTER_ROUTE = 12.5 local farming = false --// GUI local gui = Instance.new("ScreenGui") gui.Name = "PineTreeShop" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") --// MAIN FRAME local frame = Instance.new("Frame") frame.Name = "MainFrame" frame.Size = UDim2.fromOffset(200, 195) frame.Position = UDim2.new(0.5, -100, 0.5, -97) frame.BackgroundColor3 = Color3.fromRGB(80, 180, 255) frame.BorderSizePixel = 0 frame.Parent = gui local frameCorner = Instance.new("UICorner") frameCorner.CornerRadius = UDim.new(0, 15) frameCorner.Parent = frame -- Sky blue -> dark blue local gradient = Instance.new("UIGradient") gradient.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(100, 210, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(20, 50, 140)) }) gradient.Rotation = 90 gradient.Parent = frame --// TITLE local title = Instance.new("TextLabel") title.Size = UDim2.fromOffset(170, 25) title.Position = UDim2.fromOffset(15, 7) title.BackgroundTransparency = 1 title.Text = "PineTree Shop" title.TextColor3 = Color3.new(1, 1, 1) title.TextSize = 17 title.Font = Enum.Font.GothamBold title.Parent = frame --// AMOUNT BOX local amount = Instance.new("TextBox") amount.Size = UDim2.fromOffset(170, 34) amount.Position = UDim2.fromOffset(15, 35) amount.BackgroundColor3 = Color3.fromRGB(235, 250, 255) amount.TextColor3 = Color3.fromRGB(20, 40, 80) amount.PlaceholderText = "Amount" amount.Text = "1" amount.TextSize = 15 amount.Font = Enum.Font.Gotham amount.ClearTextOnFocus = false amount.BorderSizePixel = 0 amount.Parent = frame local amountCorner = Instance.new("UICorner") amountCorner.CornerRadius = UDim.new(0, 9) amountCorner.Parent = amount --// COST local cost = Instance.new("TextLabel") cost.Size = UDim2.fromOffset(170, 23) cost.Position = UDim2.fromOffset(15, 70) cost.BackgroundTransparency = 1 cost.Text = "80 gold" cost.TextSize = 15 cost.Font = Enum.Font.GothamBold cost.TextColor3 = Color3.fromRGB(255, 235, 90) cost.Parent = frame --// BUY BUTTON local buy = Instance.new("TextButton") buy.Size = UDim2.fromOffset(170, 35) buy.Position = UDim2.fromOffset(15, 96) buy.BackgroundColor3 = Color3.fromRGB(30, 100, 200) buy.TextColor3 = Color3.new(1, 1, 1) buy.Text = "Buy Pine Trees" buy.TextSize = 15 buy.Font = Enum.Font.GothamBold buy.BorderSizePixel = 0 buy.Parent = frame local buyCorner = Instance.new("UICorner") buyCorner.CornerRadius = UDim.new(0, 9) buyCorner.Parent = buy --// AUTOFARM BUTTON local farmToggle = Instance.new("TextButton") farmToggle.Size = UDim2.fromOffset(170, 35) farmToggle.Position = UDim2.fromOffset(15, 140) farmToggle.BackgroundColor3 = Color3.fromRGB(35, 75, 145) farmToggle.TextColor3 = Color3.new(1, 1, 1) farmToggle.Text = "AutoFarm: OFF" farmToggle.TextSize = 15 farmToggle.Font = Enum.Font.GothamBold farmToggle.BorderSizePixel = 0 farmToggle.Parent = frame local farmCorner = Instance.new("UICorner") farmCorner.CornerRadius = UDim.new(0, 9) farmCorner.Parent = farmToggle --// COST CALCULATOR local function updateCost() local quantity = tonumber(amount.Text) if quantity and quantity > 0 then quantity = math.floor(quantity) cost.Text = (quantity * PINE_PRICE) .. " gold" else cost.Text = "0 gold" end end amount:GetPropertyChangedSignal("Text"):Connect(updateCost) --// BUY PINE TREES buy.MouseButton1Click:Connect(function() local quantity = tonumber(amount.Text) if quantity and quantity > 0 then quantity = math.floor(quantity) Event:InvokeServer("PineTree", quantity) end end) --// AUTOFARM local function startFarm() task.spawn(function() while farming do local character = player.Character local root = character and character:FindFirstChild("HumanoidRootPart") if not root then task.wait(1) continue end for _, pointData in ipairs(points) do if not farming then break end local position = pointData[1] local duration = pointData[2] root.CFrame = CFrame.new(position) local bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.MaxForce = Vector3.new( math.huge, math.huge, math.huge ) bodyVelocity.Velocity = Vector3.zero bodyVelocity.Parent = root local startTime = os.clock() while farming and os.clock() - startTime < duration do root.CFrame = CFrame.new(position) task.wait() end bodyVelocity:Destroy() end if farming then task.wait(WAIT_AFTER_ROUTE) end end end) end --// AUTOFARM TOGGLE farmToggle.MouseButton1Click:Connect(function() farming = not farming if farming then farmToggle.Text = "AutoFarm: ON" farmToggle.BackgroundColor3 = Color3.fromRGB(30, 150, 90) startFarm() else farmToggle.Text = "AutoFarm: OFF" farmToggle.BackgroundColor3 = Color3.fromRGB(35, 75, 145) end end) --// DRAG MAIN GUI local dragging = false local dragStart local startPosition frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPosition = frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) UserInputService.InputChanged:Connect(function(input) if dragging and ( input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch ) then local delta = input.Position - dragStart frame.Position = UDim2.new( startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y ) end end) --// SHOW/HIDE TOGGLE local toggle = Instance.new("TextButton") toggle.Name = "ToggleButton" toggle.Size = UDim2.fromOffset(40, 40) toggle.Position = UDim2.new(0, 12, 0.5, -20) toggle.BackgroundColor3 = Color3.fromRGB(35, 90, 170) toggle.Text = "🌲" toggle.TextSize = 19 toggle.BorderSizePixel = 0 toggle.Parent = gui local toggleCorner = Instance.new("UICorner") toggleCorner.CornerRadius = UDim.new(0, 12) toggleCorner.Parent = toggle toggle.MouseButton1Click:Connect(function() frame.Visible = not frame.Visible end) --// DRAG TOGGLE local toggleDragging = false local toggleDragStart local toggleStartPosition toggle.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then toggleDragging = true toggleDragStart = input.Position toggleStartPosition = toggle.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then toggleDragging = false end end) end end) UserInputService.InputChanged:Connect(function(input) if toggleDragging and ( input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch ) then local delta = input.Position - toggleDragStart toggle.Position = UDim2.new( toggleStartPosition.X.Scale, toggleStartPosition.X.Offset + delta.X, toggleStartPosition.Y.Scale, toggleStartPosition.Y.Offset + delta.Y ) end end) updateCost()