I want to wait for a player to load, before my code can begin. How do i do this? plz
waiting for a player to load- before you do anything?
2 answers
There's really no point to wait for the Player to load, because the Player will always exist. But you probably meant the Character.
As Hungry mentioned, repeat loops will work fine:
repeat wait() until plr.Character
LordDragon's comment said that this will work:
plr.CharacterAdded:wait()
But you don't want to do this, or at least not only this. The reason for this is that if the character already exists, it will wait until you respawn again, because the event won't fire. A common solution to this is to do the following:
local character = plr.Character or plr.CharacterAdded:wait()
What this does is see if the character already exists, and if it does, assign the variable to it. But if it doesn't exist, then it waits for the CharacterAdded event to fire.
local player = game.Players.Player
repeat wait() until Player.Character
repeats wait() until the character of local player is found.
1 comment
dude there is an easier way, player.CharacterAdded:wait()
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
CharacterAdded and wait until more than 8 things are inside of the character.
^ doesnt sound legit
^It works though