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)
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?
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
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)