LoadCharacterAppearance
Deprecated
This item is deprecated. Do not use it for new work.
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
,Shirt
s,ShirtGraphic
s,CharacterMesh
es,BodyColor
s, andAccoutrement
s are parented to the player’s character.Decal
s,FileMesh
es,SpecialMesh
es,BlockMesh
es,CylinderMesh
es, andTexture
s are parented to the character’s head.Tool
s andHopperBin
s 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 |
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)