this is my code but I keep getting this error: ServerScriptService.Script:5: attempt to index nil with 'Character'
game.Players.PlayerAdded:Connect(function(player) print(player.name "joined") end) if not player.Character then print("waiting for character") player.CharacterAdded:wait(); char = player.Character else char = player.Character end
put your if statement inside the function. Your if statement does not know what player is because the player is a parameter of the function and it is only available for code inside the function (someone please explain this better).