Covalence.RustPlayer when converting IPlayer to a stringSolved

The Error:

You Changed the name of 

Covalence.RustPlayer[76561############, killswitch to testing

My Code:

	[Command("nick")]
        private void nickCommand(IPlayer player, string Command, string[] args)
        {

            string originalName = player.Name;

            
            if (args.Length == 1)
            {

                
                var Nickname = args[0];
                if (Nickname != null)
                { 
                    player.Rename(Nickname);
                    player.Reply("Named changed to " + Nickname);
                }
            }
            else if (args.Length == 0)
            {
                player.Reply("You didn't specify a name!");
            }



            if (args.Length == 2)    //This is the part below is giving me the error i think
            {

            string name = args[1];
             var target = players.FindPlayer(args[0]); 
             if (target != null)
             
            {
                target.Rename(name);
                player.Reply($"You Changed the name of <color=red>{target}</color> to <color=red>{name}</color>");
            }
            }​

I get the error when i do

/nick (playersName) (Nickname)

e.g. /nick killswitch testing

That isn't an error... you are converting the IPlayer to a string with {target}. I expect you want {target.Name} instead, but you'd also want to do it BEFORE the rename.

Oh ok cheers!

Locked automatically