--[[
Script: Auto Chest Collector with Auto E Interaction
- Press [ to start/stop
- Automatically interacts with chests using ProximityPrompt
- Each chest is visited only once
]]
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local TOGGLE_KEY = Enum.KeyCode.LeftBracket -- [
local INTERACT_RANGE = 10
local zoneFolder = workspace:WaitForChild("LootZones"):WaitForChild("Zone5")
local enabled = false
local unvisitedChests = {}
local currentChest = nil
local lastInteractionTime = 0
-- Collect all chest parts/models from Zone5
local function getAllChests()
unvisitedChests = {}
for _, obj in ipairs(zoneFolder:GetDescendants()) do
if obj:IsA("BasePart") then
table.insert(unvisitedChests, obj)
elseif obj:IsA("Model") and obj.PrimaryPart then
table.insert(unvisitedChests, obj.PrimaryPart)
end
end
end
-- Teleport to a random unvisited chest
local function teleportToNextChest()
if #unvisitedChests == 0 then
print("✅ All chests collected.")
enabled = false
currentChest = nil
return
end
local index = math.random(1, #unvisitedChests)
currentChest = table.remove(unvisitedChests, index)
if currentChest and HumanoidRootPart then
HumanoidRootPart.CFrame = currentChest.CFrame + Vector3.new(0, 5, 0)
end
end
-- Auto-use any ProximityPrompt near the chest
local function tryAutoInteract()
if not enabled or not currentChest or not HumanoidRootPart then return end
for _, prompt in ipairs(currentChest:GetDescendants()) do
if prompt:IsA("ProximityPrompt") and prompt.Enabled then
local parentPart = prompt.Parent
if parentPart and parentPart:IsA("BasePart") then
local distance = (HumanoidRootPart.Position - parentPart.Position).Magnitude
if distance <= math.min(prompt.MaxActivationDistance, INTERACT_RANGE) then
-- Prevent spamming
if tick() - lastInteractionTime > 0.5 then
fireproximityprompt(prompt)
lastInteractionTime = tick()
print("✅ Interacted with chest:", currentChest:GetFullName())
wait(0.25) -- Small delay to ensure prompt finishes
teleportToNextChest()
end
end
end
end
end
end
-- Toggle script on/off with [
UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == TOGGLE_KEY then
enabled = not enabled
if enabled then
getAllChests()
print("Chest Collector: ENABLED")
teleportToNextChest()
else
print("Chest Collector: DISABLED")
end
end
end)
-- Run check every frame
RunService.RenderStepped:Connect(function()
if enabled then
tryAutoInteract()
end
end)
Comments
No comments yet
Be the first to share your thoughts!