Adding letters???

Sorry about the ambiguous title, but here's the issue:
I want to give the player a nickname based on the first letters of the name they input, so if they type "Emmet" they'd get the nickname "Em" or if they typed "Gunther" they'd get "Gu".
What I've got is
Code:
$game_actors[1].nickname = $game_actors[1].name[0] + $game_actors[1].name[1]
And I've seen things online to indicate that that should work, provided that it is a string (I'm not certain of that but I thought it'd probably be). However, it gives a NoMethodError message because "undefined method '+' for nil:NilClass". Ideas?

Edit: fixed a typo
If that's the way you typed it, you have a typo error. There's a space between . and nickname when there shouldn't be.
Sorry about the ambiguous title, but here's the issue:
I want to give the player a nickname based on the first letters of the name they input, so if they type "Emmet" they'd get the nickname "Em" or if they typed "Gunther" they'd get "Gu".
What I've got is
Code:
$game_actors[1]. nickname = $game_actors[1].name[0] + $game_actors[1].name[1]
And I've seen things online to indicate that that should work, provided that it is a string (I'm not certain of that but I thought it'd probably be). However, it gives a NoMethodError message because "undefined method '+' for nil:NilClass". Ideas?
If that's the way you typed it, you have a typo error. There's a space between . and nickname when there shouldn't be.
That's a transcription error, my bad. Correcting it.
On the matter regarding this if it hasn't fixed the issue. I did go ahead and inject that in a script call and it works just fine via events.
On the matter regarding this if it hasn't fixed the issue. I did go ahead and inject that in a script call and it works just fine via events.
That's really weird. I've modified very little of the script and what I have modified (save file stuff) shouldn't be affecting it.

It's possible that I accidentally corrected whatever the issue is in transcription, but I doubt it. I'll look it over again and get back to you.

Edit: SO APPARENTLY THAT WASN'T AS IMPOSSIBLE AS I THOUGHT! I changed the actor id in the example for simplicity's sake, but my original script called the wrong actor's id for the second part, and the actor's name I was calling was empty so there wasn't a first and second character to add.

Tldr: The sample is correct and I need to reread my scripts very meticulously because sometimes I'm an idiot.
Glad you were able to solve it! A good indicator is to double check if the actor id exists in your database it will always throw an error if that actor isn't created. And that anytime you call from $game_actor you use the corresponding database id but any calls from $game_party.members always starts from 0.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/adding-letters.129415/