local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local function getCharacterRoot() local char = player.Character or player.CharacterAdded:Wait() local hrp = char:WaitForChild("HumanoidRootPart", 5) or char:FindFirstChild("Torso") return char, hrp end local ChestsFolder = workspace:WaitForChild("HalloweenChestFolder") local SugarFolder = workspace:WaitForChild("SugarFolder") local lastProcessed = {} local DEBOUNCE_SECONDS = 0.75 local function isDebounced(inst) if not inst then return true end local now = tick() local last = lastProcessed[inst] if last and now - last < DEBOUNCE_SECONDS then return true end lastProcessed[inst] = now return false end local function teleportModelToPlayer(model, hrp) if not model or not hrp then return end local root = model:FindFirstChild("RootPart") or model.PrimaryPart if root and root:IsA("BasePart") then pcall(function() root.CFrame = hrp.CFrame end) end end local function fireTouchInterest(touchPart, hrp) if not touchPart or not hrp then return end pcall(function() firetouchinterest(hrp, touchPart, 0) firetouchinterest(hrp, touchPart, 1) end) end local function triggerProximityPrompt(prompt, hrp) if not prompt or not prompt:IsA("ProximityPrompt") then return end if isDebounced(prompt) then return end local ok ok = pcall(function() if typeof(prompt.Trigger) == "function" then prompt:Trigger() end end) if ok then return end ok = pcall(function() if typeof(prompt.InputHoldBegin) == "function" then prompt:InputHoldBegin() task.wait(0.05) if typeof(prompt.InputHoldEnd) == "function" then prompt:InputHoldEnd() end end end) if ok then return end pcall(function() local parent = prompt.Parent if parent and parent:IsA("BasePart") then fireTouchInterest(parent, hrp) else local touch = parent and parent:FindFirstChild("TouchPart") if touch and touch:IsA("BasePart") then fireTouchInterest(touch, hrp) end end end) end local function automateChestsAndSugars() local char, hrp = getCharacterRoot() if not hrp then return end for _, chest in ipairs(ChestsFolder:GetChildren()) do if chest and chest:IsA("Model") and not isDebounced(chest) then teleportModelToPlayer(chest, hrp) local root = chest:FindFirstChild("RootPart") or chest.PrimaryPart local prompt if root then prompt = root:FindFirstChildOfClass("ProximityPrompt") or root:FindFirstChildWhichIsA("ProximityPrompt") end if not prompt then prompt = chest:FindFirstChildOfClass("ProximityPrompt", true) end if prompt then triggerProximityPrompt(prompt, hrp) end end end for _, sugar in ipairs(SugarFolder:GetChildren()) do if sugar and not isDebounced(sugar) then local touchPart = sugar:FindFirstChild("TouchPart") or sugar:FindFirstChildWhichIsA("BasePart") if touchPart and hrp then teleportModelToPlayer(sugar, hrp) fireTouchInterest(touchPart, hrp) end end end end local AUTO_INTERVAL = 0.8 local running = false local function startAutomationLoop() if running then return end running = true task.spawn(function() while running and player.Parent do automateChestsAndSugars() task.wait(AUTO_INTERVAL) end end) end local function stopAutomationLoop() running = false end player.CharacterAdded:Connect(function() lastProcessed = {} task.wait(0.1) startAutomationLoop() end) if player.Character then startAutomationLoop() end ChestsFolder.ChildAdded:Connect(function() task.spawn(automateChestsAndSugars) end) SugarFolder.ChildAdded:Connect(function() task.spawn(automateChestsAndSugars) end)