player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
wait(configuration.RESPAWN_TIME)
player:LoadCharacter()
print('Died', player.Name)
player.CharacterAppearanceLoaded:Connect(function()
print('Loaded', player.Name)
if not configuration.GAME_RUNNING then return end
print('Load complete', player.Name)
classesManager:GiveClass(player)
end)
end)
end)
Output prints ‘Died’ with the players name whenever they die, but sometimes after a player has respawned, it won’t print ‘Loaded’ (after the CharacterAppearanceLoaded function)
I’d say around 9/10 this function never fires. This occurs in both Studio, as well as online servers. What is causing this? And can it be told to wait for the characters appearance to load?
Your code it setup wrong.
You have AppearanceLoaded event inside Died event, meaning you first have to die for AppearanceLoaded event to get connected. That’s why it works after dying once.
You should setup your code so that AppearanceLoaded is outside Died event.
CharacterAppearanceLoaded needs to be inside the top-level scope (underneath PlayerAdded). This code tells your function to connect every time a Humanoid triggers the death state. The water is there before the barrel.
player.CharacterAppearanceLoaded:Connect(function()
print('Appearnce')
if not configuration.GAME_RUNNING then return end
print('Loaded')
classesManager:GiveClass(player)
end)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
wait(configuration.RESPAWN_TIME)
player:LoadCharacter()
-- player.CharacterAppearanceLoaded:Connect(function()
--if not configuration.GAME_RUNNING then return end
--classesManager:GiveClass(player)
--end)
end)
end)
Never prints anything that is inside the CharacterAppearanceLoaded function. Even after multiple resets
EDIT Works in play solo but not in server testing (could this be because server tests use characters without clothing/packages/etc??