PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

LoadCharacterAppearance

The LoadCharacterAppearance Player function places the given instance either in the player’s Player/Character, head, or StarterGear based on the instance’s class.

This is useful when giving a player’s character an asset from the Roblox catalog, such as a hat or piece of gear.

It is similar to Player/LoadCharacter, except it does not reload the entire character instance, StarterGear, or PlayerGui.

##Notes

  • Accessory|Accessories, Shirts, ShirtGraphics, CharacterMeshes, BodyColors, and Accoutrements are parented to the player’s character.
  • Decals, FileMeshes, SpecialMeshes, BlockMeshes, CylinderMeshes, and Textures are parented to the character’s head.
  • Tools and HopperBins are parented to the player’s StarterGear.
  • All other classes are ignored.

Parameters

Name Type Default Description

An instance of the asset being loaded, which can be obtained using InsertService's InsertService/LoadAsset function

Returns

Return Type Summary

No return.


Code Samples


Player:LoadCharacterAppearance

This script gives any Hat/Gear/Face/Body Part to a player once they chat the URL of the asset.

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
        local assetId = message:match("id=(%d+)")
        if assetId then
            local model = game:GetService("InsertService"):LoadAsset(assetId)
            for _, child in pairs(model:GetChildren()) do
                player:LoadCharacterAppearance(child)
            end
        end
    end)
end)