What's new
Heapleak - Scripthub

Get the most out of HeapLeak by creating a free account! Once signed in, you’ll gain full access to restricted content, be able to share your own scripts, and participate in our member-only discussions.

Build a Bunker

Version / Update: v1.0.0
Download / Script Link
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local StarterGui = game:GetService("StarterGui")

local LocalPlayer = Players.LocalPlayer

local COUNT_DESCENDANTS = true
local Y_OFFSET = 5
local TOGGLE_UI_KEY = Enum.KeyCode.H
local RENDER_TAG = "ForceMouseDefaultWhenUnlocked"

local Version = "1.6.41"
local WindUI = loadstring(game:HttpGet("https://github.com/Footagesus/WindUI/releases/download/" .. Version .. "/main.lua"))()

local LootRS = ReplicatedStorage:WaitForChild("Loot", 5)
local WorldLoot = workspace:FindFirstChild("Loot")

local function safeNotify(props)
local ok = pcall(function()
StarterGui:SetCore("SendNotification", props)
end)
if not ok then
task.spawn(function()
task.wait(1)
pcall(function()
StarterGui:SetCore("SendNotification", props)
end)
end)
end
end

local function readCategories()
local categories = {}
if not LootRS then return categories end
for _, cat in ipairs(LootRS:GetChildren()) do
if cat:IsA("Folder") then
local catName = cat.Name
categories[catName] = {}
for _, item in ipairs(cat:GetChildren()) do
categories[catName][item.Name] = 0
end
end
end
return categories
end

local function buildWorldCountMap()
local map = {}
if not WorldLoot then return map end
local list = COUNT_DESCENDANTS and WorldLoot:GetDescendants() or WorldLoot:GetChildren()
for _, inst in ipairs(list) do
map[inst.Name] = (map[inst.Name] or 0) + 1
end
return map
end

local function fillCounts(categories, worldMap)
for _, items in pairs(categories) do
for itemName in pairs(items) do
items[itemName] = worldMap[itemName] or 0
end
end
end

local function bringAllByName(itemName)
if not WorldLoot then return end
local char = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local targetCF = hrp.CFrame + Vector3.new(0, Y_OFFSET, 0)

local list = COUNT_DESCENDANTS and WorldLoot:GetDescendants() or WorldLoot:GetChildren()
for _, inst in ipairs(list) do
if inst.Name == itemName then
local obj = inst:FindFirstAncestorOfClass("Model") or inst
if obj:IsA("Model") then
if obj.PrimaryPart then
obj:PivotTo(targetCF)
else
local p = obj:FindFirstChildWhichIsA("BasePart", true)
if p then
obj.PrimaryPart = p
obj:PivotTo(targetCF)
obj.PrimaryPart = nil
end
end
else
local bp = obj:IsA("BasePart") and obj or obj:FindFirstChildWhichIsA("BasePart", true)
if bp then bp.CFrame = targetCF end
end
end
end
end

local Window = WindUI:CreateWindow({
Title = "Loot Manager",
Icon = "box",
Theme = "Dark",
Size = UDim2.fromOffset(620, 520),
})
Window:SetToggleKey(Enum.KeyCode.H)
local ButtonRefs = {}

local function buildUI(categories)
for catName, items in pairs(categories) do
local Tab = Window:Tab({
Title = catName,
Icon = "folder",
})

ButtonRefs[catName] = {}

local available, unavailable = {}, {}
for itemName, count in pairs(items) do
if count > 0 then
table.insert(available, {name = itemName, count = count})
else
table.insert(unavailable, {name = itemName, count = count})
end
end
local ordered = {}
for _, v in ipairs(available) do table.insert(ordered, v) end
for _, v in ipairs(unavailable) do table.insert(ordered, v) end

for _, data in ipairs(ordered) do
local btn = Tab:Button({
Title = string.format("%s (%d)", data.name, data.count),
Desc = "Bring all items of this name to player",
Callback = function() bringAllByName(data.name) end,
})

if data.count <= 0 then
btn:Lock()
else
btn:Unlock()
end
ButtonRefs[catName][data.name] = btn
end
end
end

local function refreshUI(categories)
for catName, items in pairs(categories) do
for itemName, count in pairs(items) do
local btn = ButtonRefs[catName] and ButtonRefs[catName][itemName]
if btn then
btn:SetTitle(string.format("%s (%d)", itemName, count))
if count > 0 then btn:Unlock() else btn:Lock() end
end
end
end
end

local Categories = readCategories()
fillCounts(Categories, buildWorldCountMap())
buildUI(Categories)

if WorldLoot then
local function recalc()
fillCounts(Categories, buildWorldCountMap())
refreshUI(Categories)
end
WorldLoot.ChildAdded:Connect(recalc)
WorldLoot.ChildRemoved:Connect(recalc)
if COUNT_DESCENDANTS then
WorldLoot.DescendantAdded:Connect(recalc)
WorldLoot.DescendantRemoving:Connect(recalc)
end
end

local player = LocalPlayer
local playerScripts = player:WaitForChild("PlayerScripts")
local PlayerModule = require(playerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()

player.CameraMode = Enum.CameraMode.LockFirstPerson
local unlocked = false

local function forceDefaultEachFrame(enable)
if enable then
RunService:BindToRenderStep(RENDER_TAG, Enum.RenderPriority.Camera.Value + 1, function()
if unlocked then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end)
else
RunService:UnbindFromRenderStep(RENDER_TAG)
end
end

local function setUnlocked(on)
unlocked = on
if unlocked then
Controls:Disable()
UserInputService.MouseIconEnabled = true
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
forceDefaultEachFrame(true)
else
forceDefaultEachFrame(false)
UserInputService.MouseIconEnabled = false
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
Controls:Enable()
end

safeNotify({
Title = unlocked and "Mouse Unlocked" or "Mouse Locked",
Text = unlocked and "Mouse free / camera paused" or "Mouse locked / camera enabled",
Duration = 3
})

print("UnlockMouse:", unlocked)
end

UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then return end

if input.KeyCode == TOGGLE_UI_KEY then
setUnlocked(not unlocked)
elseif input.KeyCode == TOGGLE_UI_KEY then
local frame = Window:GetMainFrame()
if frame then
frame.Visible = not frame.Visible
safeNotify({
Title = "Loot Manager",
Text = frame.Visible and "UI opened" or "UI hidden",
Duration = 2
})
end
end
end)

UserInputService.WindowFocusReleased:Connect(function()
if unlocked then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
UserInputService.MouseIconEnabled = true
end
end)

setUnlocked(true)

safeNotify({
Title = "Controls",
Text = ("Press %s to toggle mouse | Press %s to toggle UI"):format(TOGGLE_UI_KEY.Name, TOGGLE_UI_KEY.Name),
Duration = 7
})
[ View More ]
e04ecaef-9010-4e47-b1f4-3f71f79e3f56.webp


Loot Manager Script Description================================Overview:---------A Roblox script that provides a comprehensive loot management system with a graphical user interface. The script allows players to locate, count, and teleport loot items to their character's position.Key Features:-------------1. Loot Categorization &amp; Tracking - Automatically reads loot categories from ReplicatedStorage - Tracks all loot items in the workspace in real-time - Organizes items by category with count display2. User Interface - Clean, categorized tabbed interface using WindUI library - Dynamic button states (enabled/disabled based on item availability) - Real-time count updates as loot spawns/despawns3. Item Teleportation - One-click teleportation of all items of a specific type to player - Smart object handling (Models, BaseParts, etc.) - Configurable Y-offset for item positioning4. Mouse &amp; Camera Control - Toggle between locked first-person and free mouse modes - Customizable toggle keybind - Proper camera control integration5. Real-time Updates - Monitors workspace for loot changes - Automatic UI refresh when loot is added/removed - Optional descendant tracking for nested loot structuresConfiguration Options:----------------------- COUNT_DESCENDANTS = true/false (track nested loot objects)- Y_OFFSET = 5 (vertical offset for teleported items)- TOGGLE_UI_KEY = Enum.KeyCode.H (keybind for UI/mouse toggle)- RENDER_TAG = "ForceMouseDefaultWhenUnlocked"Controls:---------- H Key: Toggle mouse lock/UI visibility- UI Buttons: Teleport all items of selected type to playerDependencies:-------------- WindUI Library (v1.6.41) - UI framework- Roblox Services: Players, ReplicatedStorage, UserInputService, RunService, StarterGuiTechnical Details:------------------- Uses PlayerModule for proper camera controls- Implements render stepping for mouse behavior enforcement- Safe notification system with error handling- Efficient world object scanning and manipulation- Event-driven architecture for real-time updatesUsage:------1. Script automatically initializes on startup2. Press H to unlock mouse and open UI3. Browse categories to see available loot counts4. Click any available item button to teleport all instances to player5. Press H again to lock mouse and resume normal gameplayError Handling:---------------- Safe notification delivery with retry logic- Proper nil checking for game objects- Graceful handling of missing loot structures- Protected UI element updatesCompatibility:--------------Designed for Roblox games with:- Loot system in ReplicatedStorage.Loot folder- Loot objects in workspace.Loot- Standard PlayerModule camera controlsDEVELOPER: Quantum Q Studio
 
Back
Top