TagAPI:GetMaxSlots

The TagAPI:GetMaxSlots method returns the maximum number of tag slots a player can have equipped simultaneously. This value is defined in your CCTFF configuration and is typically consistent across all players, though it can be modified for VIP systems or dynamic slot upgrades.

Overview

Execution Context
Server, Client
Script Type
Server Script, Local Script
Returns
number
Side Effects
None - read-only operation

Syntax

local maxSlots = TagAPI:GetMaxSlots(player: Player)

Parameter Type Description
player odede>Player The player instance to check maximum slots for

Return Values

Return Type Description
maxSlots number The maximum number of tags that can be equipped (typically 3)

Basic Usage

Get the maximum tag slots for a player.

Lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CCTFF = require(ReplicatedStorage:WaitForChild("CCTFF"))
local TagAPI = CCTFF.TagAPI

local maxSlots = TagAPI:GetMaxSlots(player)
print(player.Name .. " can equip up to " .. maxSlots .. " tags")

Display Slot Information

Show current slots used versus maximum available.

Lua
local function displaySlotInfo(player)
    local equippedTags = TagAPI:GetEquipped(player)
    local maxSlots = TagAPI:GetMaxSlots(player)
    local usedSlots = #equippedTags
    
    print("Slot Usage: " .. usedSlots .. "/" .. maxSlots)
    print("Available: " .. (maxSlots - usedSlots))
end

displaySlotInfo(player)

Check Before Equipping

Verify slots are available before attempting to equip a tag.

Lua
local function canEquipMore(player)
    local equippedTags = TagAPI:GetEquipped(player)
    local maxSlots = TagAPI:GetMaxSlots(player)
    
    return #equippedTags < maxSlots
end

if canEquipMore(player) then
    TagAPI:Equip(player, "VIP")
    print("Tag equipped successfully")
else
    print("All slots are full!")

UI Slot Display

Create a visual slot indicator for the player.

Lua
-- LocalScript
local player = game.Players.LocalPlayer
local TagAPI = CCTFF.TagAPI
local slotContainer = script.Parent.SlotContainer

local function updateSlotDisplay()
    -- Clear existing slots
    for _, child in ipairs(slotContainer:GetChildren()) do
        if child:IsA("Frame") then
            child:Destroy()
        end
    end
    
    local maxSlots = TagAPI:GetMaxSlots(player)
    local equippedTags = TagAPI:GetEquipped(player)
    
    -- Create slot frames
    for i = 1, maxSlots do
        local slot = Instance.new("Frame")
        slot.Name = "Slot" .. i
        slot.Size = UDim2.new(0, 80, 0, 80)
        slot.Position = UDim2.new(0.05 + (i - 1) * 0.3, 0, 0.1, 0)
        
        -- Color based on if slot is filled
        if equippedTags[i] then
            slot.BackgroundColor3 = Color3.fromRGB(34, 197, 94) -- Green
            
            local label = Instance.new("TextLabel")
            label.Size = UDim2.new(1, 0, 1, 0)
            label.Text = equippedTags[i]
            label.TextScaled = true
            label.BackgroundTransparency = 1
            label.Parent = slot
        else
            slot.BackgroundColor3 = Color3.fromRGB(100, 100, 100) -- Gray
        end
        
        slot.Parent = slotContainer
    end
end

updateSlotDisplay()

Leaderstats Integration

Display maximum slots in player leaderstats.

Lua
game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player
    
    local maxSlots = TagAPI:GetMaxSlots(player)
    
    local slotsValue = Instance.new("IntValue")
    slotsValue.Name = "Max Slots"
    slotsValue.Value = maxSlots
    slotsValue.Parent = leaderstats
end)

Shop Slot Information

Display slot capacity in a tag shop interface.

Lua
-- LocalScript in shop UI
local player = game.Players.LocalPlayer
local TagAPI = CCTFF.TagAPI
local shopInfoLabel = script.Parent.ShopInfo

local maxSlots = TagAPI:GetMaxSlots(player)
local equippedCount = #TagAPI:GetEquipped(player)

shopInfoLabel.Text = "You can equip up to " .. maxSlots .. " tags at once.\n" ..
                     "Currently equipped: " .. equippedCount .. "/" .. maxSlots

VIP Slot Upgrade System

Check if player has upgraded slot capacity.

Lua
local DEFAULT_SLOTS = 3
local VIP_SLOTS = 5

local function getPlayerMaxSlots(player)
    -- Check if player has VIP
    if TagAPI:HasTag(player, "VIP") then
        return VIP_SLOTS
    end
    
    return DEFAULT_SLOTS
end

local maxSlots = getPlayerMaxSlots(player)
print(player.Name .. " has " .. maxSlots .. " tag slots")

Slot Purchase Validation

Verify player can purchase additional slots.

Lua
local MAX_PURCHASABLE_SLOTS = 10

local function canPurchaseSlot(player)
    local currentMax = TagAPI:GetMaxSlots(player)
    
    if currentMax >= MAX_PURCHASABLE_SLOTS then
        return false, "You already have the maximum slots"
    end
    
    return true, "Slot available for purchase"
end

local canPurchase, message = canPurchaseSlot(player)
print(message)

Warning System

Warn players when approaching slot limit.

Lua
local function checkSlotUsage(player)
    local equippedTags = TagAPI:GetEquipped(player)
    local maxSlots = TagAPI:GetMaxSlots(player)
    local usedSlots = #equippedTags
    
    if usedSlots == maxSlots then
        warn(player.Name .. " has all slots filled!")
        return "full"
    elseif usedSlots == maxSlots - 1 then
        warn(player.Name .. " has only 1 slot remaining")
        return "almost_full"
    else
        return "available"
    end
end

local status = checkSlotUsage(player)
print("Slot status: " .. status)

Equip with Auto-Management

Auto-unequip lowest priority tag if slots are full.

Lua
odede>local function smartEquip(player, tagId)
    local equippedTags = TagAPI:GetEquipped(player)
    local maxSlots = TagAPI:GetMaxSlots(player)
    
    -- Check if slots are full
    if #equippedTags >= maxSlots then
        -- Unequip last tag (lowest priority)
        local lowestPriorityTag = equippedTags[#equippedTags]
        TagAPI:Unequip(player, lowestPriorityTag)
        print("Auto-unequipped: " .. lowestPriorityTag)
    end
    
    -- Equip new tag
    local success, message = TagAPI:Equip(player, tagId)
    return success, message
end

smartEquip(player, "Premium")

Admin Command

Admin command to check player's max slots.

Lua
local function checkSlotsCommand(admin, args)
    local targetName = args[1]
    if not targetName then
        return false, "Usage: !checkslots [player]"
    end
    
    local targetPlayer = game.Players:FindFirstChild(targetName)
    if not targetPlayer then
        return false, "Player not found"
    end
    
    local maxSlots = TagAPI:GetMaxSlots(targetPlayer)
    local equippedCount = #TagAPI:GetEquipped(targetPlayer)
    
    local message = targetPlayer.Name .. " has " .. maxSlots .. " max slots\n" ..
                    "Currently using: " .. equippedCount .. "/" .. maxSlots
    
    return true, message
end

adminCommands["checkslots"] = checkSlotsCommand

Progressive Unlocks

Track slot unlocks through progression.

Lua
local SLOT_UNLOCK_LEVELS = {
    [1] = 3,  -- Start with 3 slots
    [10] = 4, -- Unlock 4th slot at level 10
    [25] = 5, -- Unlock 5th slot at level 25
    [50] = 6  -- Unlock 6th slot at level 50
}

local function updateSlotsForLevel(player, level)
    local newMaxSlots = 3 -- Default
    
    for unlockLevel, slots in pairs(SLOT_UNLOCK_LEVELS) do
        if level >= unlockLevel and slots > newMaxSlots then
            newMaxSlots = slots
        end
    end
    
    return newMaxSlots
end

-- Usage with level system
player.leaderstats.Level.Changed:Connect(function(newLevel)
    local newMax = updateSlotsForLevel(player, newLevel)
    print("Player now has " .. newMax .. " max slots")
end)

Slot Comparison

Compare slot capacity between multiple players.

Lua
local function compareSlots(player1, player2)
    local max1 = TagAPI:GetMaxSlots(player1)
    local max2 = TagAPI:GetMaxSlots(player2)
    
    local equipped1 = #TagAPI:GetEquipped(player1)
    local equipped2 = #TagAPI:GetEquipped(player2)
    
    print(player1.Name .. ": " .. equipped1 .. "/" .. max1 .. " slots")
    print(player2.Name .. ": " .. equipped2 .. "/" .. max2 .. " slots")
    
    if max1 > max2 then
        print(player1.Name .. " has more slots!")
    elseif max2 > max1 then
        print(player2.Name .. " has more slots!")
    else
        print("Both players have the same max slots")
    end
end

compareSlots(player1, player2)

Configuration Display

Show server configuration for max slots.

Lua
local function displayServerConfig()
    local samplePlayer = game.Players:GetPlayers()[1]
    if not samplePlayer then
        print("No players online to check")
        return
    end
    
    local maxSlots = TagAPI:GetMaxSlots(samplePlayer)
    
    print("=== Server Tag Configuration ===")
    print("Max Equipped Tags: " .. maxSlots)
    print("================================")
end

displayServerConfig()

Tutorial System

Teach new players about slot system.

Lua
local function showTutorial(player)
    local maxSlots = TagAPI:GetMaxSlots(player)
    
    local tutorialMessage = 
        "Welcome! You can equip up to " .. maxSlots .. " tags at once.\n" ..
        "Tags give you special abilities and show in chat.\n" ..
        "Collect more tags to customize your profile!"
    
    -- Send to player's GUI
    local notifyRemote = ReplicatedStorage.NotifyPlayer
    notifyRemote:FireClient(player, tutorialMessage)
end

game.Players.PlayerAdded:Connect(function(player)
    task.wait(5)
    showTutorial(player)
end)