✖ Remove Features

Disable or remove inventory features you don't need. Also learn how to extend the player lifecycle for custom game mechanics like death handling and persistent items.

Quick Reference

Common features to disable

📊

Disable Sorting

Stop items from being auto-sorted

How to →
💎

Disable Rarity

Remove rarity color display

How to →

Disable Death Re-equip

Stop auto-equipping on respawn

How to →
🚫

Disable Client

Completely disable inventory UI

How to →

Disable Sorting

Stop items from being auto-sorted in storage

Sorting is controlled by Settings.Storage.Sorting in src/shared/Settings.luau:

Settings.luau Luau
Settings.Storage = {
    Limit = 15,
    CanStack = true,
    Sorting = false,    -- Set to false to disable sorting
    MaxStackSize = 5,
    SortOrder = "None"
}
⚠ Note: Setting Sorting = false also disables the SearchFilter functionality, as sorting and search use the same UI infrastructure.

Disable Rarity

Remove rarity color frames from slots

Rarity display is controlled by two settings:

Settings.luau Luau
-- Disable rarity colors on items
Settings.Stacking = {
    RequiredFields = { "Type" },  -- Remove "Rarity" from required fields
    Blacklist = {},
    Rarity = false                 -- Set to false to hide rarity frames
}

Additionally, ensure your GUI templates don't have rarity frames, or hide them via SlotFactory:

SlotFactory.luau Luau
-- In Create function, hide rarityframe if rarity is disabled
if rarityframe then
    if Settings.Stacking.Rarity then
        -- Show with reactive colors
        scope:Hydrate(rarityframe) {
            BackgroundColor3 = scope:Computed(function(use)
                local item = use(currentItem)
                if item and item.Metadata and item.Metadata.Rarity then
                    return RarityValues.rarityColors[item.Metadata.Rarity]
                end
                return Color3.new(0.4, 0.4, 0.4)
            end),
            Visible = hasItem,
        }
    else
        -- Always hide
        rarityframe.Visible = false
    end
end

Disable Death Re-equip

Stop items from being re-equipped when player respawns

The death handling code is in src/server/StowayServerV1_2/init.luau, lines 46-61:

Current Death Handling Luau
player.CharacterAdded:Connect(function(char)

    char:FindFirstChildWhichIsA("Humanoid").Died:Once(function()
        state.died = true
    end)

    if state.died then
        InventoryService.ReloadClient(player, {configSettingName = state.Settings.UiType})

        if state.EquippedItemUUID then
            local slotType, index = SlotManager.FindSlotByUUID(state, state.EquippedItemUUID)
            InventoryService.UnequipSlot(player, true)
            InventoryService.EquipSlot(player, slotType, index, true)
        end

        state.died = false
    end
end)

Option 1: Disable Re-equip Only

Keep the reload but don't re-equip:

Disable Re-equip Luau
player.CharacterAdded:Connect(function(char)

    char:FindFirstChildWhichIsA("Humanoid").Died:Once(function()
        state.died = true
    end)

    if state.died then
        -- Just reload UI, don't re-equip
        InventoryService.ReloadClient(player, {configSettingName = state.Settings.UiType})
        state.died = false
    end
end)

Option 2: Remove Death Handling Entirely

Comment out the entire CharacterAdded block:

Remove Death Handling Luau
--[[
player.CharacterAdded:Connect(function(char)
    char:FindFirstChildWhichIsA("Humanoid").Died:Once(function() state.died = true end)

    if state.died then
        InventoryService.ReloadClient(player, {configSettingName = state.Settings.UiType})
        if state.EquippedItemUUID then 
            local slotType, index = SlotManager.FindSlotByUUID(state, state.EquippedItemUUID)
            InventoryService.UnequipSlot(player, true)
            InventoryService.EquipSlot(player, slotType, index, true)
        end
        state.died = false
    end
end)
--]]

Customize Death Behavior

Extend the player lifecycle for custom game mechanics

The death handling pattern can be extended for various game mechanics:

🗑 Clear Inventory on Death

Remove all items when player dies

See Example →

🔧 Persistent Items

Always have essential items (flashlight, etc.)

See Example →

🔓 Drop Items on Death

Drop inventory to world on death

See Example →

⚠ Keep Selected Slot

Remember and restore equipped slot

See Example →

Clear Inventory on Death

Remove all items when player dies

Clear on Death Luau
player.CharacterAdded:Connect(function(char)

    char:FindFirstChildWhichIsA("Humanoid").Died:Once(function()
        state.died = true
    end)

    if state.died then
        -- Clear all items from inventory
        for uuid in pairs(state.Items) do
            RemoveOperation.Execute(state, uuid)
        end

        -- Reset hotbar and storage arrays
        state.Hotbar = {}
        state.Storage = {}
        state.Items = {}
        state.ItemsByID = {}
        state.EquippedItemUUID = nil
        state.Weight = 0

        -- Reload client
        InventoryService.ReloadClient(player, {configSettingName = state.Settings.UiType})

        state.died = false
    end
end)

Persistent Items

Always grant essential items on respawn (e.g., flashlight)

Persistent Items Luau
-- Define persistent items (always granted on respawn)
local PERSISTENT_ITEMS = {
    { Id = "flashlight", Amount = 1 },
    { Id = "compass", Amount = 1 },
}

player.CharacterAdded:Connect(function(char)

    char:FindFirstChildWhichIsA("Humanoid").Died:Once(function()
        state.died = true
    end)

    if state.died then
        -- Reload UI first
        InventoryService.ReloadClient(player, {configSettingName = state.Settings.UiType})

        -- Grant persistent items to hotbar
        for _, item in ipairs(PERSISTENT_ITEMS) do
            InventoryService.AddItem(player, item.Id, item.Amount, nil, true)
        end

        -- Restore equipped item if exists
        if state.EquippedItemUUID then
            local slotType, index = SlotManager.FindSlotByUUID(state, state.EquippedItemUUID)
            if slotType and index then
                InventoryService.EquipSlot(player, slotType, index, true)
            end
        end

        state.died = false
    end
end)
💡 Tip: Persistent items are great for essential gameplay items like flashlights, maps, radios, or quest items that players should always have.

Drop Items on Death

Drop inventory to world when player dies

Drop on Death Luau
local ItemSpawner = require(script.World.ItemSpawner)

player.CharacterAdded:Connect(function(char)

    local humanoid = char:FindFirstChildWhichIsA("Humanoid")
    
    humanoid.Died:Once(function()
        state.died = true
        
        -- Get spawn position
        local spawnPos = char:GetPrimaryPartCFrame().Position
        local dropPosition = spawnPos + Vector3.new(0, 3, 0)
        
        -- Drop all items to world
        for uuid, item in pairs(state.Items) do
            if item.Metadata and item.Metadata.Droppable ~= false then
                -- Spawn item in world
                ItemSpawner.Spawn({
                    Name = item.Id,
                    Amount = item.Amount,
                    Position = dropPosition + Vector3.new(
                        math.random(-5, 5),
                        0,
                        math.random(-5, 5)
                    ),
                    Metadata = item.Metadata,
                })
            end
        end
        
        -- Clear inventory
        state.Hotbar = {}
        state.Storage = {}
        state.Items = {}
        state.ItemsByID = {}
        state.EquippedItemUUID = nil
        state.Weight = 0
    end)

    if state.died then
        InventoryService.ReloadClient(player, {configSettingName = state.Settings.UiType})
        state.died = false
    end
end)

Disable Client Completely

Completely disable the inventory UI for specific players

This feature is useful for spectators, certain game modes, or when you want to completely hide the inventory from specific players. It requires both server and client coordination.

Server Side

Server - Disable Client Luau
-- Add to init.luau

function InventoryService.DisableClient(player: Player)
    local state = PlayerInventories[player]
    if not state then return { success = false, reason = "NO_INVENTORY" } end

    -- Send disable signal to client
    local remotesFolder = Replicator.GetRemotesFolder()
    local disableRemote = remotesFolder:FindFirstChild("DisableStoway")
    if disableRemote then
        disableRemote:FireClient(player)
    end

    return { success = true }
end

Client Side - Add to init.luau

Client - Handle Disable Luau
-- Add this to SetupRemotes() or init section

-- Get disable remote (create if needed)
local remotesFolder = ReplicatedStorage:WaitForChild("Remotes")
local disableRemote = remotesFolder:FindFirstChild("DisableStoway")
if not disableRemote then
    disableRemote = Instance.new("RemoteEvent")
    disableRemote.Name = "DisableStoway"
    disableRemote.Parent = remotesFolder
end

-- Handle disable signal
disableRemote.OnClientEvent:Connect(function()
    print("[Stoway] Disabling client...")

    -- 1. Destroy UI
    if InventoryGui then
        InventoryGui:Destroy()
        InventoryGui = nil
    end

    -- 2. Clean up scopes
    if HotbarScope then
        HotbarScope:doCleanup()
        HotbarScope = nil
    end
    if StorageScope then
        StorageScope:doCleanup()
        StorageScope = nil
    end

    -- 3. Destroy input
    InputManager.Destroy()
    InteractionManager.Destroy()
    SelectionManager.Destroy()
    DragHandler.Destroy()

    -- 4. Disconnect network
    NetworkHandler.Destroy()

    -- 5. Clean up connections
    for _, conn in ipairs(InputConnections) do
        conn:Disconnect()
    end
    table.clear(InputConnections)

    -- 6. Clear references
    BackpackFrame = nil
    HotbarFrame = nil
    ScrollingBackpack = nil
    DraggingGui = nil

    print("[Stoway] Client disabled successfully")
end)

Usage

Usage Example Luau
-- Disable inventory for spectator players
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    if player.GetRankInGroup(player, 123456) == 0 then  -- Not in group
        -- Wait for inventory to initialize
        task.wait(1)
        InventoryService.DisableClient(player)
    end
end)

Related Documentation

See also