How to detect that Character is fully loaded in Local script?

Hello
I want to execute action in local script when player’s character is fully loaded.
CharacterAdded and CharacterAppearanceLoaded does not seem to fire at all in the Local script?
Should I place a script inside StarterCharacterScripts and hope that it will be executed only after the Character is fully loaded on the client?

Thanks

CharacterAppearanceLoaded should run on the client?

local player = game.Players.LocalPlayer
player.CharacterAppearanceLoaded:Wait()
print("Appearance loaded")

It does not work for me
I have several scripts in StarterPlayerScripts and Roblox puts several more system scripts there.
May be the event fires while one of the other scripts is executing and before my script has a chance to wait or to subscribe to the event…

Hello Tati,
the answer you are looking for is the following.

local player_Local = game.Players.LocalPlayer

repeat task.wait() until player_Local.Character

local player_Local_character = player_Local.Character

This method uses the in built task library Roblox provides & will (yield) retry until a Character is loaded in fully.

It will work in any valid local script container (:

Roblox already has a built-in feature that allows you to wait for the character without a repeat.

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

Polling like this is bad; that code is going to run every heartbeat when it shouldn’t.


There are two ways on doing this, but I recommend the second and I’ll explain why.

Ternary Operators

local Character = Player.Character or Player.CharacterAdded:Wait()

Seperate Logic in Functions

local Player = game:GetService("Players").LocalPlayer

local function OnCharacterAdded(Character)
	
end

local function OnCharacterRemoving(Character)
	
end

if Player.Character then OnCharacterAdded(Player.Character) end

Player.CharacterAdded:Connect(OnCharacterAdded)
Player.CharacterRemoving:Connect(OnCharacterRemoving)

They reason I’d recommend the second is because it will gaurentee all your logic is going to be ran everytime the character spawns/despawns without having to reclone the script (You don’t need to put your LocalScript in a container that resets on Player death).

This CharacterAdded:Wait() feature does not work 100% of the time. It is simply prone to error with a nil value.

Magma, there are many ways to go at it. The method I recommended runs around 6 times (heartbeats) the last time I checked. Ensuring values are not nil should be a bigger priority, thus the script I recommended will retry until it retrieves something of value. If you are concerned about the amount of times it runs, you could always configure the wait time or a max amount of retries.

Contextual to his use case, however I believe he only wanted to know how you detect a fully loaded in Character.