Kartik Scripts

onCharacterCreated

Registers a callback that runs when a player finishes the character creator. The creator is a separate UI from the clothing shop, so it has its own hook. onShopClosed does not fire when the creator is saved.

It fires however the creator was opened: through your multicharacter (InitializeCharacter), startPlayerCustomization or openCharacterCreator. Unlike those callbacks, which belong to whoever opened the creator, any number of resources can listen here.


๐Ÿ’ก Syntax

exports['kartik-clothing']:onCharacterCreated(function(appearance) end)

๐Ÿ“ฅ Parameters

ParameterTypeOptionalDescription
cbfunctionNoCalled with the saved appearance table once the character is created.

๐Ÿ“ค Returns

TypeDescription
booleantrue if the callback was registered.

Callbacks are removed automatically when the resource that registered them stops, so it is safe to register again on restart.

๐Ÿ’ป Example

exports['kartik-clothing']:onCharacterCreated(function(appearance)
    -- The starter outfit is now on the ped and saved.
    for _, comp in ipairs(appearance.components or {}) do
        print(('component %d = %d/%d'):format(comp.component_id, comp.drawable, comp.texture))
    end
end)

๐Ÿ“ก Event

The same appearance is sent as a client event:

AddEventHandler('kartik-clothing:client:characterCreated', function(appearance)
    print('character created')
end)

On this page