Auto chest
Key Required

Auto chest

[THE VOICES:TOAB] Enigmatic Trollverse [BETA]IsFullHubIsFullHub 21.4K views 19 executesUpdated May 6, 2024
4.0/ 5(5 votes)
4180% Positive
Lua Script•86 lines (2278 chars)
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local Workspace = game:GetService("Workspace")

local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

local Backpack = LocalPlayer.Backpack
local Chests = Workspace:WaitForChild("chests")
local OpenedChests = {}
local TotalChests = 0
_G.IsFarming = true


local function getChests()
    local unopenedChests = {}
    TotalChests = 0

    for _, chest in pairs(Chests:GetChildren()) do
        if not OpenedChests[chest] then
            table.insert(unopenedChests, chest)
            TotalChests = TotalChests + 1
        end
    end

    return unopenedChests
end

local function findNearestChest(chests)
    local nearestChest
    local shortestDistance = math.huge
    local playerPosition = HumanoidRootPart.Position

    for _, chest in pairs(chests) do
        local distance = (playerPosition - chest.Position).magnitude
        if distance < shortestDistance then
            shortestDistance = distance
            nearestChest = chest
        end
    end

    return nearestChest
end

local function activateProximityPrompt(chest)
    local proximityPrompt = chest:FindFirstChild("ProximityPrompt")
    if proximityPrompt then
        proximityPrompt:InputHoldBegin(Enum.UserInputType.Keyboard)
        wait(1.5)   
 proximityPrompt:InputHoldEnd(Enum.UserInputType.Keyboard)
    end
end

local function collectChest(nearestChest)
    local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
    local tween = TweenService:Create(HumanoidRootPart, tweenInfo, {CFrame = nearestChest.CFrame})
    tween:Play()
    tween.Completed:Wait()

    activateProximityPrompt(nearestChest)

    OpenedChests[nearestChest] = true

end

local function handleFarming()
    if _G.IsFarming then
        local unopenedChests = getChests()
        local nearestChest = findNearestChest(unopenedChests)
        
        if nearestChest then
            collectChest(nearestChest)
            repeat
                wait()
            until not Backpack:FindFirstChild(nearestChest.Name)
        end
    else
      return --false
    end
end

while true do
    handleFarming()
    wait(0.1)
end

Features & Information

UPDATED! V2 It must surely have one, several error(s) or not

Community Comments (11)

IsFullHubIsFullHubMay 6, 2024(edited)

@Zins

OmanOmanMay 6, 2024(edited)

Op af

SinitySinityMay 7, 2024(edited)

Got a script for the other cups, Or any of the chest?

OmanOmanMay 7, 2024(edited)

Ye i want the chest one and cups so i can get the Omni ***

OmanOmanMay 7, 2024(edited)

Cup

IsFullHubIsFullHubMay 7, 2024(edited)

@velesz and @lmaslalaksmakakas I'm going to try but I'm not promising anything because I'm still a beginner and I'm on the phone now because my computer gave up on me so I'm warning in advance I'm going to take some time so, if there is an update in the script consider yourself lucky.

OmanOmanMay 7, 2024(edited)

Ok pls update us when the release what so ever

SinitySinityMay 8, 2024(edited)

W update!

zinszinsMay 12, 2024(edited)

very proud! good job

OmanOmanMay 12, 2024(edited)

Any upd?

IsFullHubIsFullHubMay 13, 2024(edited)

@lmaslalaksmakakas, Why an update? If you found one or more problem(s) you might as well say so because I don't really check if the creators update the game