--// Pumpkin Collector – Closest First + GUI + Manual Movement Friendly local player -- find the local player dynamically for _, obj in ipairs(game:GetDescendants()) do if obj:IsA("Player") then player = obj break end end if not player then warn("Player not found!") return end repeat task.wait() until player:FindFirstChild("PlayerGui") local char = player.Character or player.CharacterAdded:Wait() -- function to get HRP safely each loop local function getHRP() char = player.Character or player.CharacterAdded:Wait() return char:FindFirstChild("HumanoidRootPart") end -- dynamic search for Pumpkins folder local function findPumpkinFolder() for _, obj in ipairs(game:GetDescendants()) do if obj:IsA("Folder") and obj.Name == "Pumpkins" then local parent = obj.Parent if parent and parent.Name == "Physical" and parent.Parent and parent.Parent.Name == "Map" then return obj end end end return nil end -- get closest collectible local function getClosestPart(parts, hrp) local closest = nil local dist = math.huge for _, p in ipairs(parts) do if p:IsA("BasePart") and p.Name ~= "Pumpkin" then local d = (hrp.Position - p.Position).Magnitude if d < dist then dist = d closest = p end end end return closest end -- GUI local gui = Instance.new("ScreenGui") gui.Name = "PumpkinWalkGui" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 270, 0, 120) frame.Position = UDim2.new(0.02, 0, 0.55, 0) frame.BackgroundColor3 = Color3.fromRGB(25,25,25) frame.BackgroundTransparency = 0.1 frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true frame.Parent = gui local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 25) title.Text = "Pumpkin Collector" title.BackgroundTransparency = 1 title.TextColor3 = Color3.fromRGB(255,255,255) title.TextScaled = true title.Font = Enum.Font.GothamBold title.Parent = frame local onButton = Instance.new("TextButton") onButton.Size = UDim2.new(0.45, 0, 0, 30) onButton.Position = UDim2.new(0.05, 0, 0.4, 0) onButton.Text = "ON" onButton.BackgroundColor3 = Color3.fromRGB(0,150,0) onButton.TextColor3 = Color3.fromRGB(255,255,255) onButton.TextScaled = true onButton.Font = Enum.Font.Gotham onButton.Parent = frame local offButton = Instance.new("TextButton") offButton.Size = UDim2.new(0.45, 0, 0, 30) offButton.Position = UDim2.new(0.5, 0, 0.4, 0) offButton.Text = "OFF" offButton.BackgroundColor3 = Color3.fromRGB(150,0,0) offButton.TextColor3 = Color3.fromRGB(255,255,255) offButton.TextScaled = true offButton.Font = Enum.Font.Gotham offButton.Parent = frame -- states local walkingEnabled = false onButton.MouseButton1Click:Connect(function() walkingEnabled = true onButton.BackgroundColor3 = Color3.fromRGB(0,180,0) offButton.BackgroundColor3 = Color3.fromRGB(150,0,0) end) offButton.MouseButton1Click:Connect(function() walkingEnabled = false offButton.BackgroundColor3 = Color3.fromRGB(180,0,0) onButton.BackgroundColor3 = Color3.fromRGB(0,150,0) end) -- main walk loop local targetPart = nil task.spawn(function() while task.wait(0.5) do if not walkingEnabled then continue end local folder = findPumpkinFolder() if not folder then continue end local hrpNow = getHRP() if not hrpNow then continue end local humanoid = char:FindFirstChildOfClass("Humanoid") if not humanoid then continue end -- pick a new target if none or reached previous if not targetPart or (hrpNow.Position - targetPart.Position).Magnitude < 3 then targetPart = getClosestPart(folder:GetChildren(), hrpNow) end if targetPart then -- only MoveTo if not very close if (hrpNow.Position - targetPart.Position).Magnitude > 2 then humanoid:MoveTo(targetPart.Position) end end end end)