TagAPI:UnequipAll

The TagAPI:UnequipAll method removes all equipped tags from a player, leaving owned tags unchanged. This is commonly used for loadout resets, switching contexts, or enforcing equipment slot limits. It is available server-side and can be called from admin scripts, shop mechanics, or automated systems.

Overview

Execution Context
Server
Script Type
Server Script
Returns
boolean
Side Effects
All tags are unequipped; owned tags remain

Syntax

local success = TagAPI:UnequipAll(player: Player)

Parameter Type Description
player Player The player whose equipped tags should be removed

Return Values

Return Type Description
success boolean True if all equipped tags were removed, false otherwise

Basic Usage

Unequip all tags for a player.

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

local success = TagAPI:UnequipAll(player)
if success then
    print("All tags unequipped for " .. player.Name)
else
    print("Error unequipping tags")
end

Loadout Reset

Reset a player's equipped tags before loading a new preset.

Lua
local function resetAndSetLoadout(player, loadoutTags)
    TagAPI:UnequipAll(player)
    for _, tagId in ipairs(loadoutTags) do
        TagAPI:Equip(player, tagId)
    end
    print("Loadout applied for " .. player.Name)
end

-- Usage: resetAndSetLoadout(targetPlayer, {"VIP", "Premium"})

Shop Purchase

Unequip all tags before granting new equipment via shop.

Lua
local function purchaseEquipment(player, newTagId)
    TagAPI:UnequipAll(player)
    TagAPI:Equip(player, newTagId)
    print("Purchased and equipped tag: " .. newTagId)
end

-- Usage: purchaseEquipment(targetPlayer, "Booster")

Admin Command

Admin command to force unequip all tags for a player.

Lua
local function unequipAllCommand(admin, args)
    local targetName = args[1]
    local targetPlayer = game.Players:FindFirstChild(targetName)
    if not targetPlayer then
        return false, "Player not found"
    end

    local success = TagAPI:UnequipAll(targetPlayer)
    if success then
        return true, "Unequipped all tags for " .. targetPlayer.Name
    else
        return false, "Failed to unequip tags"
    end
end

adminCommands["unequipall"] = unequipAllCommand

Team Context Switch

Unequip all tags when switching teams.

Lua
game.Teams.TeamSwitched.Event:Connect(function(player, oldTeam, newTeam)
    TagAPI:UnequipAll(player)
    print("Tags unequipped for " .. player.Name .. " switching to " .. newTeam.Name)
end)

Enforce Slot Policy

Automatically unequip all tags when policy violation detected.

Lua
local function checkSlotPolicy(player)
    local equippedTags = TagAPI:GetEquipped(player)
    local maxSlots = TagAPI:GetMaxSlots()
    if #equippedTags > maxSlots then
        TagAPI:UnequipAll(player)
        print("Enforced slot policy for " .. player.Name)
    end
end

game.Players.PlayerAdded:Connect(checkSlotPolicy)

Leaderstats Reset

Reset "Equipped Tags" count in leaderstats on unequip.

Lua
local function resetEquippedLeaderstat(player)
    TagAPI:UnequipAll(player)
    local leaderstats = player:FindFirstChild("leaderstats")
    if leaderstats then
        local equipped = leaderstats:FindFirstChild("Equipped Tags")
        if equipped then equipped.Value = 0 end
    end
end

-- Usage: resetEquippedLeaderstat(targetPlayer)