local player = game.Players.LocalPlayer local canTeleport = true local collecting = true -- Flag to control auto-collection local screenGui = Instance.new("ScreenGui", player.PlayerGui) local mainFrame = Instance.new("Frame", screenGui) local feedbackLabel = Instance.new("TextLabel", mainFrame) local stopButton = Instance.new("TextButton", mainFrame) local closeButton = Instance.new("TextButton", mainFrame) -- New close button -- Frame Properties mainFrame.Size = UDim2.new(0, 300, 0, 300) mainFrame.Position = UDim2.new(0.5, -150, 0.5, -150) mainFrame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2) mainFrame.BorderSizePixel = 0 mainFrame.BackgroundTransparency = 0.1 mainFrame.ClipsDescendants = true local uiCorner = Instance.new("UICorner", mainFrame) uiCorner.CornerRadius = UDim.new(0, 12) -- Feedback Label Properties feedbackLabel.Size = UDim2.new(0, 200, 0, 50) feedbackLabel.Position = UDim2.new(0.5, -100, 0.5, -120) feedbackLabel.Text = "" feedbackLabel.BackgroundTransparency = 1 feedbackLabel.TextColor3 = Color3.new(1, 1, 1) feedbackLabel.Font = Enum.Font.SourceSansBold feedbackLabel.TextSize = 24 -- Stop Button Properties stopButton.Size = UDim2.new(0, 200, 0, 50) stopButton.Position = UDim2.new(0.5, -100, 0.5, 40) stopButton.Text = "Stop Collecting" stopButton.BackgroundColor3 = Color3.new(1, 0, 0) stopButton.TextColor3 = Color3.new(1, 1, 1) stopButton.Font = Enum.Font.SourceSansBold stopButton.TextSize = 24 stopButton.BorderSizePixel = 0 stopButton.BackgroundTransparency = 0.2 stopButton.AutoButtonColor = false local stopButtonCorner = Instance.new("UICorner", stopButton) stopButtonCorner.CornerRadius = UDim.new(0, 8) -- Close Button Properties closeButton.Size = UDim2.new(0, 200, 0, 50) closeButton.Position = UDim2.new(0.5, -100, 0.5, 100) closeButton.Text = "Close" closeButton.BackgroundColor3 = Color3.new(0, 0.8, 0) closeButton.TextColor3 = Color3.new(1, 1, 1) closeButton.Font = Enum.Font.SourceSansBold closeButton.TextSize = 24 closeButton.BorderSizePixel = 0 closeButton.BackgroundTransparency = 0.2 closeButton.AutoButtonColor = false local closeButtonCorner = Instance.new("UICorner", closeButton) closeButtonCorner.CornerRadius = UDim.new(0, 8) -- Function to handle feedback message display local function displayFeedback(message) feedbackLabel.Text = message wait(2) feedbackLabel.Text = "" end -- Function to collect candy local function collectCandy(candy) if candy:IsA("Part") then -- Simulate the pickup action (you might need to customize this based on your game) candy:Destroy() -- Or however your game handles candy collection displayFeedback("Collected: " .. candy.Name) end end -- Function to teleport the player to all instances of HalloweenCandy local function teleportToAllCandy() local items = workspace.drops:GetChildren() -- Get all children in "drops" folder local candyLocations = {} -- Table to store positions of "HalloweenCandy" items -- Loop through items to find all HalloweenCandy for _, item in ipairs(items) do if item.Name == "HalloweenCandy" then table.insert(candyLocations, item) -- Store found items end end if #candyLocations == 0 then displayFeedback("No HalloweenCandy found!") return end if canTeleport then canTeleport = false -- Loop through each found instance of HalloweenCandy and teleport to it for _, candy in ipairs(candyLocations) do if not collecting then displayFeedback("Stopped collecting!") canTeleport = true return end if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.CFrame = candy.CFrame + Vector3.new(0, 3, 0) -- Teleport above the item displayFeedback("Teleported to: " .. candy.Name) -- Simulate "spam pressing E" by calling the collection function repeatedly for i = 1, 5 do -- You can adjust the number of iterations here collectCandy(candy) wait(0.1) -- You can adjust the delay between iterations here end wait(0.5) -- Wait for a second before the next teleport else displayFeedback("Character not found!") break end end canTeleport = true -- Allow teleportation again after all items are processed else displayFeedback("You are on cooldown. Please wait.") end end -- Function to continuously collect candies local function autoCollectCandies() while collecting do teleportToAllCandy() wait(5) -- Wait 5 seconds before checking for candies again end end -- Stop button click event stopButton.MouseButton1Click:Connect(function() collecting = false end) -- Close button click event closeButton.MouseButton1Click:Connect(function() screenGui.Enabled = false end) -- Start the auto-collection process autoCollectCandies() -- Function to close the UI (if needed) local function closeUI() screenGui.Enabled = false end -- Draggable GUI Logic local UserInputService = game:GetService("User InputService") local dragging = false local dragInput local startMousePosition local startPosition mainFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragInput = input startMousePosition = UserInputService:GetMouseLocation() startPosition = mainFrame.Position end end) mainFrame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end) UserInputService.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then local delta = UserInputService:GetMouseLocation() - startMousePosition mainFrame.Position = UDim2.new(startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y) end end) -- Show GUI with a tween (optional) local TweenService = game:GetService("TweenService") local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out) -- Show GUI with a tween local function showGUI() screenGui.Enabled = true TweenService:Create(mainFrame, tweenInfo, {BackgroundTransparency = 0}):Play() end showGUI()