Title pretty much says it all.
game.Players.PlayerAdded:connect(function(player) createstats(player) cloneready(player) clonespawned(player) clonefirst(player) updategui() print("Functions executed") -- this does print player.CharacterAdded:connect(function(character) print("Character added") -- This doesn't print logo(player) player.PlayerGui.SpawnGui.BG.Visible = true character.Humanoid.Died:connect(function() died(player) end) end) end)
I get no errors in the output. CharacterAdded has been a very finicky thing for me before now and I'd really like to know if I'm just using it wrong.
edit: After doing some more testing in my place, I found out that characteradded fires when the player respawns, but not on the first spawn. I am using a test server rather than play solo, so characteradded should work the first time, but it doesn't...
edit2: I also went to the real place on my profile and played it there. The characteradded function still didn't fire when I spawned, but did after I died.
The first spawn most likely occurs before you can attach the CharacterAdded
event.
The cleanest way to fix this is to make your CharacterAdded a function on its own and simulate that CharacterAdded event right after you attach it.
function NewCharacter(character,player) print("Character added") -- This doesn't print logo(player) player.PlayerGui.SpawnGui.BG.Visible = true character.Humanoid.Died:connect(function() died(player) end) end game.Players.PlayerAdded:connect(function(player) createstats(player) cloneready(player) clonespawned(player) clonefirst(player) updategui() print("Functions executed") -- this does print player.CharacterAdded:connect(function(character) NewCharacter(character,player); end) if player.Character then -- We were too late getting the -- CharacterAdded attached--there already -- was a character, so we need to simulate -- the event firing here. NewCharacter(player.Character,player); end end)