99 Nights Teleport To Items After Bring items Patched
Key Required

99 Nights Teleport To Items After Bring items Patched

99 Nights in the Forest πŸ”¦xeidendevxeidendev 4.1K views 29 executesUpdated Aug 1, 2025
5.0/ 5(3 votes)
30100% Positive
Lua Scriptβ€’965 lines (33928 chars)
--// ============== SETTINGS ============== \\--

-- Target items with desired quantities and CATEGORY
local targetItems = {
    ["Log"] = {quantity = 10, category = "Material"},
    ["Coal"] = {quantity = 15, category = "Material"},
    ["Fuel"] = {quantity = 5, category = "Consumable"},
    ["Berry"] = {quantity = 15, category = "Food"},
    ["Alien Chest"] = {quantity = 2, category = "Container"},
    ["Bolt"] = {quantity = 20, category = "Material"},
    ["Coin Stack"] = {quantity = -1, category = "Currency"},
    ["Fuel Canister"] = {quantity = 8, category = "Consumable"},
    ["Item Chest"] = {quantity = 3, category = "Container"},
    ["Laser Fence Blueprint"] = {quantity = 1, category = "Blueprint"},
    ["Old Flashlight"] = {quantity = 2, category = "Tool"},
    ["Old Radio"] = {quantity = 1, category = "Tool"},
    ["Revolver Ammo"] = {quantity = 50, category = "Ammo"},
    ["Rifle Ammo"] = {quantity = 100, category = "Ammo"},
    ["Sheet Metal"] = {quantity = 25, category = "Material"},
    ["UFO Component"] = {quantity = 5, category = "Component"},
    ["UFO Scrap"] = {quantity = 15, category = "Component"},
    ["Old Car Engine"] = {quantity = 1, category = "Vehicle Part"},
    ["Rifle"] = {quantity = 1, category = "Weapon"},
    ["Seed Box"] = {quantity = 5, category = "Farming"},
    ["Steak"] = {quantity = 10, category = "Food"},
    ["Strong Flashlight"] = {quantity = 1, category = "Tool"},
    ["Stronghold Diamond Chest"] = {quantity = 1, category = "Container"},
    ["Tyre"] = {quantity = 4, category = "Vehicle Part"},
    ["Washing Machine"] = {quantity = 1, category = "Furniture"},
    ["Wolf Corpse"] = {quantity = 3, category = "Resource"},
    ["Wolf Pelt"] = {quantity = 5, category = "Resource"},
    ["Alpha Wolf Corpse"] = {quantity = 1, category = "Resource"},
    ["Anvil Back"] = {quantity = 1, category = "Crafting"},
    ["Anvil Base"] = {quantity = 1, category = "Crafting"},
    ["Anvil Front"] = {quantity = 1, category = "Crafting"},
    ["Apple"] = {quantity = 10, category = "Food"},
    ["Bandage"] = {quantity = 5, category = "Medical"},
    ["Broken Microwave"] = {quantity = 1, category = "Furniture"},
    ["Cake"] = {quantity = 1, category = "Food"},
    ["Chair"] = {quantity = 2, category = "Furniture"},
    ["Leather Body"] = {quantity = 1, category = "Armor"},
    ["Medkit"] = {quantity = 3, category = "Medical"},
    ["Morsel"] = {quantity = 10, category = "Food"},
    ["Notice"] = {quantity = 1, category = "Miscellaneous"},
    ["Oil Barrel"] = {quantity = 2, category = "Container"},
}

-- Add Item Chest1 to Item Chest20 with a "Container" category
for i = 1, 20 do
    targetItems["Item Chest" .. i] = {quantity = 1, category = "Container"}
end

-- Define categories for easy iteration and UI creation
local categories = {"All", "Food", "Material", "Container", "Tool", "Weapon"}

-- How often the teleport can be used (in seconds)
local COOLDOWN = 1

-- Teleport settings
local TELEPORT_OFFSET = 5 -- Distance to teleport from the item
local AUTO_COLLECT_MODE = false -- Whether to automatically collect multiple items

--// ====================================== \\--

-- Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Player = Players.LocalPlayer

-- Variables
local canTeleport = true
local canScan = true
local canDiscover = true
local collectedItems = {}
local availableItems = {}
local discoveredItems = {}
local currentCategory = "All"
local itemPositions = {} -- Store item positions for teleportation

-- Wait for PlayerGui to be available
local playerGui = Player:WaitForChild("PlayerGui")

-- ============== MODERN iOS THEME GUI ============== 
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "iOSItemTeleporter"
screenGui.Parent = playerGui
screenGui.ResetOnSpawn = false
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

-- Main Container (iOS-style card)
local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 220, 0, 380)
mainFrame.Position = UDim2.new(0.5, -110, 0.5, -190)
mainFrame.BackgroundColor3 = Color3.fromRGB(242, 242, 247) -- iOS light gray
mainFrame.BorderSizePixel = 0
mainFrame.Draggable = true
mainFrame.Active = true
mainFrame.Parent = screenGui

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 14) -- iOS rounded corners
corner.Parent = mainFrame

-- Shadow effect
local shadow = Instance.new("ImageLabel")
shadow.Name = "Shadow"
shadow.Image = "rbxassetid://1316045217"
shadow.ImageColor3 = Color3.fromRGB(0, 0, 0)
shadow.ImageTransparency = 0.88
shadow.ScaleType = Enum.ScaleType.Slice
shadow.SliceCenter = Rect.new(10, 10, 118, 118)
shadow.Size = UDim2.new(1, 20, 1, 20)
shadow.Position = UDim2.new(0, -10, 0, -10)
shadow.BackgroundTransparency = 1
shadow.Parent = mainFrame
shadow.ZIndex = -1

-- Header
local header = Instance.new("Frame")
header.Size = UDim2.new(1, 0, 0, 44)
header.BackgroundColor3 = Color3.fromRGB(242, 242, 247)
header.BorderSizePixel = 0
header.Parent = mainFrame

local headerCorner = Instance.new("UICorner")
headerCorner.CornerRadius = UDim.new(0, 14)
headerCorner.Parent = header

local title = Instance.new("TextLabel")
title.Parent = header
title.Size = UDim2.new(1, 0, 0.6, 0)
title.Position = UDim2.new(0, 0, 0, 0)
title.BackgroundTransparency = 1
title.TextColor3 = Color3.fromRGB(0, 0, 0)
title.Font = Enum.Font.SourceSansSemibold
title.Text = "99 Nights - TELEPORTER"
title.TextSize = 16
title.TextYAlignment = Enum.TextYAlignment.Bottom

local subtitle = Instance.new("TextLabel")
subtitle.Parent = header
subtitle.Size = UDim2.new(1, 0, 0.4, 0)
subtitle.Position = UDim2.new(0, 0, 0.6, 0)
subtitle.BackgroundTransparency = 1
subtitle.TextColor3 = Color3.fromRGB(120, 120, 128)
subtitle.Font = Enum.Font.SourceSans
subtitle.Text = "Teleport to nearby items"
subtitle.TextSize = 12
subtitle.TextYAlignment = Enum.TextYAlignment.Top

-- Tab Bar (iOS-style segmented control)
local tabContainer = Instance.new("Frame")
tabContainer.Parent = mainFrame
tabContainer.Size = UDim2.new(1, -20, 0, 28)
tabContainer.Position = UDim2.new(0, 10, 0, 50)
tabContainer.BackgroundColor3 = Color3.fromRGB(229, 229, 234)
tabContainer.BorderSizePixel = 0

local tabCorner = Instance.new("UICorner")
tabCorner.CornerRadius = UDim.new(1, 0)
tabCorner.Parent = tabContainer

local tabListLayout = Instance.new("UIListLayout")
tabListLayout.Parent = tabContainer
tabListLayout.FillDirection = Enum.FillDirection.Horizontal
tabListLayout.Padding = UDim.new(0, 1)

-- Mode Toggle
local modeToggle = Instance.new("Frame")
modeToggle.Parent = mainFrame
modeToggle.Size = UDim2.new(1, -20, 0, 30)
modeToggle.Position = UDim2.new(0, 10, 0, 85)
modeToggle.BackgroundTransparency = 1

local modeLabel = Instance.new("TextLabel")
modeLabel.Parent = modeToggle
modeLabel.Size = UDim2.new(0.6, 0, 1, 0)
modeLabel.BackgroundTransparency = 1
modeLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
modeLabel.Font = Enum.Font.SourceSans
modeLabel.Text = "Auto-collect mode:"
modeLabel.TextSize = 14
modeLabel.TextXAlignment = Enum.TextXAlignment.Left

local modeSwitch = Instance.new("TextButton")
modeSwitch.Parent = modeToggle
modeSwitch.Size = UDim2.new(0, 50, 0, 25)
modeSwitch.Position = UDim2.new(0.6, 0, 0, 2.5)
modeSwitch.BackgroundColor3 = Color3.fromRGB(200, 200, 205)
modeSwitch.Text = ""
modeSwitch.BorderSizePixel = 0

local switchCorner = Instance.new("UICorner")
switchCorner.CornerRadius = UDim.new(1, 0)
switchCorner.Parent = modeSwitch

local switchIndicator = Instance.new("Frame")
switchIndicator.Parent = modeSwitch
switchIndicator.Size = UDim2.new(0, 21, 0, 21)
switchIndicator.Position = UDim2.new(0, 2, 0, 2)
switchIndicator.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
switchIndicator.BorderSizePixel = 0

local indicatorCorner = Instance.new("UICorner")
indicatorCorner.CornerRadius = UDim.new(1, 0)
indicatorCorner.Parent = switchIndicator

-- Status Bar
local statusBar = Instance.new("Frame")
statusBar.Parent = mainFrame
statusBar.Size = UDim2.new(1, -20, 0, 20)
statusBar.Position = UDim2.new(0, 10, 0, 160)
statusBar.BackgroundTransparency = 1

local statusLabel = Instance.new("TextLabel")
statusLabel.Parent = statusBar
statusLabel.Size = UDim2.new(1, 0, 1, 0)
statusLabel.BackgroundTransparency = 1
statusLabel.TextColor3 = Color3.fromRGB(120, 120, 128)
statusLabel.Font = Enum.Font.SourceSans
statusLabel.Text = "Ready to scan"
statusLabel.TextSize = 12
statusLabel.TextXAlignment = Enum.TextXAlignment.Left

-- Item List (iOS-style table view)
local scrollFrame = Instance.new("ScrollingFrame")
scrollFrame.Parent = mainFrame
scrollFrame.Size = UDim2.new(1, -10, 1, -180)
scrollFrame.Position = UDim2.new(0, 5, 0, 180)
scrollFrame.BackgroundTransparency = 1
scrollFrame.ScrollBarThickness = 4
scrollFrame.ScrollBarImageColor3 = Color3.fromRGB(200, 200, 205)
scrollFrame.BorderSizePixel = 0
scrollFrame.BottomImage = ""
scrollFrame.MidImage = ""
scrollFrame.TopImage = ""

local listLayout = Instance.new("UIListLayout")
listLayout.Parent = scrollFrame
listLayout.Padding = UDim.new(0, 2)

-- ============== TELEPORTATION FUNCTIONS ==============

-- Function to safely teleport player
local function teleportToPosition(position, itemName)
    local character = Player.Character
    if not character or not character:FindFirstChild("HumanoidRootPart") then
        statusLabel.Text = "❌ Character not found!"
        return false
    end

    local humanoidRootPart = character.HumanoidRootPart
    
    -- Calculate safe teleport position (slightly offset from item)
    local offsetPosition = position + Vector3.new(
        math.random(-TELEPORT_OFFSET, TELEPORT_OFFSET),
        2, -- Slightly above ground
        math.random(-TELEPORT_OFFSET, TELEPORT_OFFSET)
    )
    
    -- Create smooth teleport effect
    local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
    local tween = TweenService:Create(humanoidRootPart, tweenInfo, {
        CFrame = CFrame.new(offsetPosition)
    })
    
    statusLabel.Text = "πŸš€ Teleporting to " .. itemName .. "..."
    tween:Play()
    
    tween.Completed:Connect(function()
        statusLabel.Text = "βœ… Teleported to " .. itemName .. "!"
        task.wait(1)
        if statusLabel and statusLabel.Parent then
            statusLabel.Text = "Ready to teleport"
        end
    end)
    
    return true
end

-- Function to teleport to specific item
local function teleportToSpecificItem(itemName)
    if not canTeleport then 
        statusLabel.Text = "⏳ Teleport on cooldown..."
        return 
    end
    
    canTeleport = false
    
    local character = Player.Character
    if not character or not character:FindFirstChild("HumanoidRootPart") then
        statusLabel.Text = "❌ Character not found!"
        canTeleport = true
        return
    end

    local itemsFound = {}
    local itemData = targetItems[itemName] or {quantity = 1}
    
    statusLabel.Text = "πŸ” Finding " .. itemName .. "..."
    
    -- Search through workspace for specific item
    for _, item in pairs(workspace:GetDescendants()) do
        if item.Name == itemName then
            local position = nil
            
            -- Get item position based on type
            if item:IsA("BasePart") then
                position = item.Position
            elseif item:IsA("Model") then
                local primaryPart = item.PrimaryPart or item:FindFirstChildOfClass("BasePart")
                if primaryPart then
                    position = primaryPart.Position
                end
            end
            
            if position then
                table.insert(itemsFound, {item = item, position = position})
            end
        end
    end
    
    if #itemsFound == 0 then
        statusLabel.Text = "❌ No " .. itemName .. " found!"
        canTeleport = true
        return
    end
    
    -- Find closest item
    local playerPosition = character.HumanoidRootPart.Position
    local closestItem = nil
    local closestDistance = math.huge
    
    for _, itemInfo in pairs(itemsFound) do
        local distance = (playerPosition - itemInfo.position).Magnitude
        if distance < closestDistance then
            closestDistance = distance
            closestItem = itemInfo
        end
    end
    
    if closestItem then
        teleportToPosition(closestItem.position, itemName)
    else
        statusLabel.Text = "❌ Could not find accessible " .. itemName
    end
    
    -- Reset cooldown
    task.spawn(function()
        task.wait(COOLDOWN)
        canTeleport = true
    end)
end

-- Function to auto-collect mode (teleport to multiple items)
local function autoCollectItems()
    if not canTeleport then 
        statusLabel.Text = "⏳ Auto-collect on cooldown..."
        return 
    end
    
    if not AUTO_COLLECT_MODE then
        statusLabel.Text = "❌ Auto-collect mode disabled"
        return
    end
    
    canTeleport = false
    
    local character = Player.Character
    if not character or not character:FindFirstChild("HumanoidRootPart") then
        statusLabel.Text = "❌ Character not found!"
        canTeleport = true
        return
    end

    local itemQueue = {}
    local itemsCounted = {}
    
    statusLabel.Text = "🎯 Building teleport queue..."
    
    -- Initialize counters
    for itemName, _ in pairs(targetItems) do
        itemsCounted[itemName] = 0
    end
    
    -- Build queue of items to collect
    for _, item in pairs(workspace:GetDescendants()) do
        if targetItems[item.Name] then
            local itemName = item.Name
            local targetCount = targetItems[itemName].quantity
            
            -- Check if we need more of this item
            if targetCount == -1 or itemsCounted[itemName] < targetCount then
                local position = nil
                
                if item:IsA("BasePart") then
                    position = item.Position
                elseif item:IsA("Model") then
                    local primaryPart = item.PrimaryPart or item:FindFirstChildOfClass("BasePart")
                    if primaryPart then
                        position = primaryPart.Position
                    end
                end
                
                if position then
                    table.insert(itemQueue, {
                        name = itemName,
                        position = position,
                        item = item
                    })
                    itemsCounted[itemName] = itemsCounted[itemName] + 1
                end
            end
        end
    end
    
    if #itemQueue == 0 then
        statusLabel.Text = "❌ No target items found!"
        canTeleport = true
        return
    end
    
    -- Sort queue by distance from player
    local playerPosition = character.HumanoidRootPart.Position
    table.sort(itemQueue, function(a, b)
        local distA = (playerPosition - a.position).Magnitude
        local distB = (playerPosition - b.position).Magnitude
        return distA < distB
    end)
    
    statusLabel.Text = "πŸš€ Starting auto-collect (" .. #itemQueue .. " items)..."
    
    -- Teleport to first item (you can extend this to teleport through the queue)
    if itemQueue[1] then
        teleportToPosition(itemQueue[1].position, itemQueue[1].name)
    end
    
    -- Reset cooldown
    task.spawn(function()
        task.wait(COOLDOWN * 2) -- Longer cooldown for auto-collect
        canTeleport = true
    end)
end

-- iOS Style Button Creator
local function createiOSButton(icon, color)
    local button = Instance.new("TextButton")
    button.Size = UDim2.new(0, 36, 0, 36)
    button.BackgroundColor3 = color
    button.Text = icon
    button.TextSize = 18
    button.TextColor3 = Color3.fromRGB(255, 255, 255)
    button.AutoButtonColor = false
    
    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(1, 0)
    corner.Parent = button
    
    -- Button animation
    button.MouseButton1Down:Connect(function()
        button.Size = UDim2.new(0, 34, 0, 34)
    end)
    
    button.MouseButton1Up:Connect(function()
        button.Size = UDim2.new(0, 36, 0, 36)
    end)
    
    return button
end

-- Forward declaration for updateItemDisplay
local updateItemDisplay

-- Function to discover new items in workspace
local function discoverNewItems()
    if not canDiscover then return end
    canDiscover = false
    
    discoveredItems = {}
    local newItemsFound = 0
    
    statusLabel.Text = "πŸ” Discovering new items..."
    
    -- Scan workspace for any items not in our target list
    for _, item in pairs(workspace:GetDescendants()) do
        if item:IsA("BasePart") or item:IsA("Model") then
            local itemName = item.Name
            -- Skip if it's already in our target list or if it's a common non-item object
            if not targetItems[itemName] and not discoveredItems[itemName] then
                -- Filter out common game objects that aren't items
                local skipNames = {
                    "Baseplate", "SpawnLocation", "Camera", "Lighting", "Terrain",
                    "StarterGui", "StarterPack", "StarterPlayer", "ReplicatedStorage",
                    "ServerStorage", "Teams", "Workspace", "Players", "Part", "Block",
                    "Wedge", "CornerWedge", "Cylinder", "Ball", "Seat", "VehicleSeat",
                    "TrussPart", "WedgePart", "CornerWedgePart", "Model", "Folder",
                    "Configuration", "IntValue", "StringValue", "BoolValue", "NumberValue"
                }
                
                local shouldSkip = false
                for _, skipName in pairs(skipNames) do
                    if itemName == skipName or itemName:find("Part") or itemName:find("Block") then
                        shouldSkip = true
                        break
                    end
                end
                
                if not shouldSkip and itemName ~= "" and #itemName > 1 then
                    discoveredItems[itemName] = (discoveredItems[itemName] or 0) + 1
                    newItemsFound = newItemsFound + 1
                end
            end
        end
    end
    
    if newItemsFound > 0 then
        statusLabel.Text = "πŸ†• Found " .. newItemsFound .. " new item types!"
        -- Add discovered items to available items for display
        for itemName, count in pairs(discoveredItems) do
            if not targetItems[itemName] then -- Only add if truly new
                targetItems[itemName] = {quantity = 1, category = "Miscellaneous"}
            end
            availableItems[itemName] = count
        end
        updateItemDisplay()
    else
        statusLabel.Text = "βœ… No new items found."
    end
    
    task.spawn(function()
        task.wait(1)
        canDiscover = true
    end)
end

-- Function to create item entry in the list
local function createItemEntry(itemName, found, target)
    local entry = Instance.new("TextButton")
    entry.Name = itemName .. "_Entry"
    entry.Size = UDim2.new(1, -10, 0, 40)
    entry.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
    entry.BorderSizePixel = 0
    entry.Text = ""
    entry.AutoButtonColor = false
    entry.Parent = scrollFrame
    
    local entryCorner = Instance.new("UICorner")
    entryCorner.CornerRadius = UDim.new(0, 8)
    entryCorner.Parent = entry
    
    local itemData = targetItems[itemName] or {quantity = 1, category = "Miscellaneous"}
    local displayTarget = itemData.quantity
    
    -- Click to teleport to individual item
    entry.MouseButton1Click:Connect(function()
        if found > 0 then -- Only allow clicking if items are available
            teleportToSpecificItem(itemName)
        end
    end)
    
    local itemLabel = Instance.new("TextLabel")
    itemLabel.Parent = entry
    itemLabel.Size = UDim2.new(0.6, 0, 0.7, 0)
    itemLabel.Position = UDim2.new(0, 10, 0, 0)
    itemLabel.BackgroundTransparency = 1
    itemLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
    itemLabel.Font = Enum.Font.SourceSans
    itemLabel.Text = itemName
    itemLabel.TextSize = 14
    itemLabel.TextXAlignment = Enum.TextXAlignment.Left
    itemLabel.ClipsDescendants = true
    
    local categoryLabel = Instance.new("TextLabel")
    categoryLabel.Parent = entry
    categoryLabel.Size = UDim2.new(0.6, 0, 0.3, 0)
    categoryLabel.Position = UDim2.new(0, 10, 0.7, 0)
    categoryLabel.BackgroundTransparency = 1
    categoryLabel.TextColor3 = Color3.fromRGB(120, 120, 128)
    categoryLabel.Font = Enum.Font.SourceSans
    categoryLabel.Text = itemData.category or "Unknown"
    categoryLabel.TextSize = 10
    categoryLabel.TextXAlignment = Enum.TextXAlignment.Left
    
    local countLabel = Instance.new("TextLabel")
    countLabel.Parent = entry
    countLabel.Size = UDim2.new(0.25, -10, 0.5, 0)
    countLabel.Position = UDim2.new(0.6, 0, 0, 0)
    countLabel.BackgroundTransparency = 1
    countLabel.Font = Enum.Font.SourceSansSemibold
    countLabel.TextSize = 14
    countLabel.TextXAlignment = Enum.TextXAlignment.Right
    
    local teleportIcon = Instance.new("TextLabel")
    teleportIcon.Parent = entry
    teleportIcon.Size = UDim2.new(0.15, 0, 0.5, 0)
    teleportIcon.Position = UDim2.new(0.85, 0, 0.25, 0)
    teleportIcon.BackgroundTransparency = 1
    teleportIcon.Text = "πŸš€"
    teleportIcon.TextSize = 16
    teleportIcon.TextXAlignment = Enum.TextXAlignment.Center
    
    -- Color coding based on target vs found
    if found == 0 then
        countLabel.Text = "0/" .. (displayTarget == -1 and "∞" or displayTarget)
        countLabel.TextColor3 = Color3.fromRGB(180, 180, 188)
        itemLabel.TextColor3 = Color3.fromRGB(120, 120, 128)
        entry.BackgroundColor3 = Color3.fromRGB(248, 248, 248)
        teleportIcon.TextTransparency = 0.7
    elseif displayTarget == -1 then
        countLabel.Text = found .. " (∞)"
        countLabel.TextColor3 = Color3.fromRGB(52, 199, 89)
        teleportIcon.TextTransparency = 0
    elseif found >= displayTarget then
        countLabel.Text = found .. "/" .. displayTarget .. " βœ“"
        countLabel.TextColor3 = Color3.fromRGB(52, 199, 89)
        teleportIcon.TextTransparency = 0
    else
        countLabel.Text = found .. "/" .. displayTarget
        countLabel.TextColor3 = Color3.fromRGB(0, 122, 255)
        teleportIcon.TextTransparency = 0
    end
    
    -- Highlight effect
    entry.MouseEnter:Connect(function()
        if found > 0 then
            entry.BackgroundColor3 = Color3.fromRGB(240, 240, 245)
        end
    end)
    
    entry.MouseLeave:Connect(function()
        entry.BackgroundColor3 = found > 0 and Color3.fromRGB(255, 255, 255) or Color3.fromRGB(248, 248, 248)
    end)
    
    return entry
end

-- Function to update the item list display based on the current category
updateItemDisplay = function()
    -- Clear existing entries
    for _, child in pairs(scrollFrame:GetChildren()) do
        if child:IsA("TextButton") and child.Name:match("_Entry$") then
            child:Destroy()
        end
    end
    
    -- Create new entries
    for itemName, itemData in pairs(targetItems) do
        if currentCategory == "All" or itemData.category == currentCategory then
            local foundCount = availableItems[itemName] or 0
            createItemEntry(itemName, foundCount, itemData.quantity)
        end
    end
    
    -- Update canvas size
    scrollFrame.CanvasSize = UDim2.new(0, 0, 0, listLayout.AbsoluteContentSize.Y + 10)
end

-- Function to scan workspace for items
function scanWorkspaceItems()
    if not canScan then return end
    canScan = false
    
    availableItems = {}
    itemPositions = {}
    local totalItems = 0
    
    statusLabel.Text = "πŸ” Scanning workspace..."
    
    -- Look in workspace and common item containers
    local function scanContainer(container, containerName)
        for _, item in pairs(container:GetDescendants()) do
            if targetItems[item.Name] then
                availableItems[item.Name] = (availableItems[item.Name] or 0) + 1
                totalItems = totalItems + 1
                
                -- Store position for teleportation
                local position = nil
                if item:IsA("BasePart") then
                    position = item.Position
                elseif item:IsA("Model") then
                    local primaryPart = item.PrimaryPart or item:FindFirstChildOfClass("BasePart")
                    if primaryPart then
                        position = primaryPart.Position
                    end
                end
                
                if position then
                    if not itemPositions[item.Name] then
                        itemPositions[item.Name] = {}
                    end
                    table.insert(itemPositions[item.Name], position)
                end
            end
        end
    end
    
    -- Scan main workspace
    scanContainer(workspace, "Workspace")
    
    -- Scan common item container names
    local itemContainers = workspace:FindFirstChild("Items") or workspace:FindFirstChild("ItemSpawns") or workspace:FindFirstChild("Collectibles")
    if itemContainers then
        scanContainer(itemContainers, "Items Container")
    end
    
    statusLabel.Text = "πŸ“Š Found " .. totalItems .. " target items"
    updateItemDisplay()
    
    task.spawn(function()
        task.wait(1)
        canScan = true
    end)
end

-- Mode Switch functionality
modeSwitch.MouseButton1Click:Connect(function()
    AUTO_COLLECT_MODE = not AUTO_COLLECT_MODE
    
    local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
    
    if AUTO_COLLECT_MODE then
        -- Switch ON
        modeSwitch.BackgroundColor3 = Color3.fromRGB(52, 199, 89) -- Green
        local tween = TweenService:Create(switchIndicator, tweenInfo, {
            Position = UDim2.new(0, 27, 0, 2)
        })
        tween:Play()
        statusLabel.Text = "βœ… Auto-collect mode enabled"
    else
        -- Switch OFF
        modeSwitch.BackgroundColor3 = Color3.fromRGB(200, 200, 205) -- Gray
        local tween = TweenService:Create(switchIndicator, tweenInfo, {
            Position = UDim2.new(0, 2, 0, 2)
        })
        tween:Play()
        statusLabel.Text = "❌ Auto-collect mode disabled"
    end
    
    task.spawn(function()
        task.wait(2)
        statusLabel.Text = "Ready to teleport"
    end)
end)

-- Category Buttons
local function createTabButton(name)
    local button = Instance.new("TextButton")
    button.Name = name .. "Tab"
    button.Size = UDim2.new(1/#categories, 0, 1, 0)
    button.BackgroundColor3 = name == "All" and Color3.fromRGB(255, 255, 255) or Color3.fromRGB(229, 229, 234)
    button.TextColor3 = name == "All" and Color3.fromRGB(0, 122, 255) or Color3.fromRGB(120, 120, 128)
    button.Font = Enum.Font.SourceSansSemibold
    button.Text = name
    button.TextSize = 12
    button.AutoButtonColor = false
    button.BorderSizePixel = 0
    button.Parent = tabContainer

    local buttonCorner = Instance.new("UICorner")
    buttonCorner.CornerRadius = UDim.new(1, 0)
    buttonCorner.Parent = button

    button.MouseButton1Click:Connect(function()
        for _, btn in pairs(tabContainer:GetChildren()) do
            if btn:IsA("TextButton") then
                btn.BackgroundColor3 = Color3.fromRGB(229, 229, 234)
                btn.TextColor3 = Color3.fromRGB(120, 120, 128)
            end
        end
        button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        button.TextColor3 = Color3.fromRGB(0, 122, 255) -- iOS blue
        
        currentCategory = name
        updateItemDisplay()
    end)
    
    return button
end

-- Create category tabs
for _, cat in ipairs(categories) do
    createTabButton(cat)
end

-- Action Buttons (Compact horizontal layout)
local buttonContainer = Instance.new("Frame")
buttonContainer.Parent = mainFrame
buttonContainer.Size = UDim2.new(1, -20, 0, 36)
buttonContainer.Position = UDim2.new(0, 10, 0, 120)
buttonContainer.BackgroundTransparency = 1

local buttonLayout = Instance.new("UIListLayout")
buttonLayout.Parent = buttonContainer
buttonLayout.FillDirection = Enum.FillDirection.Horizontal
buttonLayout.Padding = UDim.new(0, 10)
buttonLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center

-- Scan Button
local scanButton = createiOSButton("πŸ”", Color3.fromRGB(0, 122, 255)) -- Blue
scanButton.Parent = buttonContainer
scanButton.MouseButton1Click:Connect(scanWorkspaceItems)

-- Discover Button
local discoverButton = createiOSButton("πŸ†•", Color3.fromRGB(255, 149, 0)) -- Orange
discoverButton.Parent = buttonContainer
discoverButton.MouseButton1Click:Connect(discoverNewItems)

-- Auto-Collect Button
local autoButton = createiOSButton("🎯", Color3.fromRGB(52, 199, 89)) -- Green
autoButton.Parent = buttonContainer
autoButton.MouseButton1Click:Connect(autoCollectItems)

-- Nearest Item Button
local nearestButton = createiOSButton("πŸ“", Color3.fromRGB(255, 59, 48)) -- Red
nearestButton.Parent = buttonContainer

-- Function to teleport to nearest item
local function teleportToNearestItem()
    if not canTeleport then 
        statusLabel.Text = "⏳ Teleport on cooldown..."
        return 
    end
    
    canTeleport = false
    
    local character = Player.Character
    if not character or not character:FindFirstChild("HumanoidRootPart") then
        statusLabel.Text = "❌ Character not found!"
        canTeleport = true
        return
    end

    local playerPosition = character.HumanoidRootPart.Position
    local nearestItem = nil
    local nearestDistance = math.huge
    local nearestItemName = ""
    
    statusLabel.Text = "πŸ” Finding nearest item..."
    
    -- Search through workspace for nearest target item
    for _, item in pairs(workspace:GetDescendants()) do
        if targetItems[item.Name] then
            local position = nil
            
            if item:IsA("BasePart") then
                position = item.Position
            elseif item:IsA("Model") then
                local primaryPart = item.PrimaryPart or item:FindFirstChildOfClass("BasePart")
                if primaryPart then
                    position = primaryPart.Position
                end
            end
            
            if position then
                local distance = (playerPosition - position).Magnitude
                if distance < nearestDistance then
                    nearestDistance = distance
                    nearestItem = position
                    nearestItemName = item.Name
                end
            end
        end
    end
    
    if nearestItem then
        statusLabel.Text = "πŸš€ Teleporting to nearest " .. nearestItemName .. " (" .. math.floor(nearestDistance) .. " studs away)"
        teleportToPosition(nearestItem, nearestItemName)
    else
        statusLabel.Text = "❌ No target items found!"
    end
    
    -- Reset cooldown
    task.spawn(function()
        task.wait(COOLDOWN)
        canTeleport = true
    end)
end

nearestButton.MouseButton1Click:Connect(teleportToNearestItem)

-- Keybind support
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    
    -- T key for teleporting to nearest item
    if input.KeyCode == Enum.KeyCode.T then
        teleportToNearestItem()
    -- R key for scanning
    elseif input.KeyCode == Enum.KeyCode.R then
        scanWorkspaceItems()
    -- G key for auto-collect (if enabled)
    elseif input.KeyCode == Enum.KeyCode.G and AUTO_COLLECT_MODE then
        autoCollectItems()
    end
end)

-- Add keybind info to status
local keybindInfo = Instance.new("TextLabel")
keybindInfo.Parent = mainFrame
keybindInfo.Size = UDim2.new(1, -20, 0, 15)
keybindInfo.Position = UDim2.new(0, 10, 1, -20)
keybindInfo.BackgroundTransparency = 1
keybindInfo.TextColor3 = Color3.fromRGB(120, 120, 128)
keybindInfo.Font = Enum.Font.SourceSans
keybindInfo.Text = "Keybinds: T=Nearest, R=Scan, G=Auto-collect"
keybindInfo.TextSize = 10
keybindInfo.TextXAlignment = Enum.TextXAlignment.Center

-- Initial scan after a brief delay to ensure everything is loaded
task.spawn(function()
    task.wait(1)
    scanWorkspaceItems()
end)

-- Create a waypoint system for tracking teleported locations
local waypointHistory = {}
local maxWaypoints = 5

local function addWaypoint(position, itemName)
    table.insert(waypointHistory, 1, {
        position = position,
        name = itemName,
        timestamp = tick()
    })
    
    -- Keep only the last maxWaypoints
    while #waypointHistory > maxWaypoints do
        table.remove(waypointHistory)
    end
end

-- Function to teleport back to previous location
local function teleportToPreviousWaypoint()
    if #waypointHistory > 1 then -- Skip current location
        local waypoint = waypointHistory[2]
        if waypoint then
            teleportToPosition(waypoint.position, "Previous: " .. waypoint.name)
        end
    else
        statusLabel.Text = "❌ No previous locations"
    end
end

-- Add waypoint button
local waypointButton = createiOSButton("↩️", Color3.fromRGB(142, 142, 147)) -- Gray
waypointButton.Parent = buttonContainer
waypointButton.MouseButton1Click:Connect(teleportToPreviousWaypoint)

-- Override teleportToPosition to add waypoint tracking
local originalTeleportToPosition = teleportToPosition
teleportToPosition = function(position, itemName)
    addWaypoint(position, itemName)
    return originalTeleportToPosition(position, itemName)
end

print("βœ… Teleporter loaded successfully!")
print("πŸ“‹ Targeting " .. tostring(#targetItems) .. " different item types")
print("πŸ” Use scan button to find items")
print("πŸš€ Click items to teleport to them")
print("🎯 Enable auto-collect mode for sequential teleporting")
print("⌨️  Keybinds: T=Nearest, R=Scan, G=Auto-collect")
print("πŸ“ Waypoint system tracks your last 5 locations")

Features & Information

This script will work better when the map reach its max FEATURES: -Teleport to any item (literally)

Community Comments (2)

VantaXockVantaXockAug 1, 2025

Great Job buddyπŸ˜„

darktexevdarktexevAug 1, 2025

I tried numerous scripts and they have the same issue with bring item. I can't wait to try this out!

More Scripts for 99 Nights in the Forest πŸ”¦