How can I detect when character fully loaded?

I want to detect when the character is fully loaded to the game to give him equipment.

The problem is that I can detect when the player spawn but the character will not be loaded yet (using player.CharacterAdded).

I tried to use player.CharacterAppearanceLoaded but it did bot work (the code did not do anything) I think that because the character do not have any accessories when he is loaded.

the code using player.CharacterAdded :

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function() 
		local data = dataFun.GetData(player.Name) --get player data
		giveEquipment(player, data) --give the player equipment
	end)
end)

the code using player.CharacterAppearanceLoaded:

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function()
		local data = dataFun.GetData(player.Name) --get player data
		giveEquipment(player, data) --give the player equipment
	end)
end)
4 Likes

Pretty sure you can just wait for the HumanoidRootPart

3 Likes
local char = player.Character or player.CharacterAdded:Wait() -- If already added but if its not wait for the character
char:WaitForChild("HumanoidRootPart") -- Wait until the humanoid root part and when it does proceed with the script

Maybe wait for a specific child that pops up in the character?

Have you tried using a wait on the character added?

player.CharacterAdded:Wait()
-- code to run once character has been added

Would this yield a difference? The code runs when the Character is added anyways?

1 Like

When the character is added some things are not added yet I think. Like hats and accessories.

You updated your code but before it was just

local char = player.Character or player.CharacterAdded:Wait()

Which wouldn’t help.

1 Like

You could wait for an accessory like this:

 local char = player.Character or player.CharacterAdded:Wait()
char:WaitForChildOfClass("Accessory")
2 Likes

I did this before and it work

local character = workspace:WaitForChild(player.Name)

What are you using this for? Detecting if a player joins?
If so make a script in serverscriptservice and do this:

game.Players.PlayerAdded:Connect(function()
--code here
end)

Yes because CharacterAdded is fired when it spawns the character not when its loading it. Also if you are giving the player tools, Why not put it into their StarterGear

1 Like

waiting for the character to be in the workspace after the player is added

game.Players.PlayerAdded:Connect(function(player)
    local char = player.Character or player.CharacterAdded:Wait()
    --code here
end)

This won’t work. The Character is not in workspace jet.

What do you mean? The script fires when the player joins then gets the character when its added to workspace.

Yes. But the Character is not loaded.

This should work.

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(Character)
		wait(Character:WaitForChild("HumanoidRootPart"))
		local data = dataFun.GetData(player.Name) --get player data
		giveEquipment(player, data) --give the player equipment
	end)
end)
4 Likes

I think the issue is that we have no clue what OP wants to achieve :smiley:

You dont need a wait

Character:WaitForChild("HumanoidRootPart")
1 Like

Nice catch, Was thinking of something else :=) but yeah @belalg1 it would be appreciated if you could tell us what you are trying to do.