In my game, for some reason players are not spawning on the spawns, so I am trying to create a script to force them to go to the spawn when they join the game.
However, I am getting the error: ServerScriptService.SpawnPlayerOnAdd:8: attempt to index nil with 'WaitForChild’
Having only Player.CharacterAdded:Wait() won’t be as efficient, if the character is already added, it will yield forever.
The safest (and best) approach is the following code:
local Character = Player.Character or Player.CharacterAdded:Wait()
yep. Since if one is nil, the other is not, the character would still be defined by the one that is not nil.
Adding if Character then may help but not needed.
What you’re saying is not making any sense, you’re basically agreeing with me (unless that was your point).
Regardless, this issue has been solved.