How to name a player

I’m making a Earthbound fan game, and i’m having trouble naming the charterers he’s my code
using UnityEngine;
using UnityEngine.SceneManagement;

public class Askname : MonoBehaviour
{
    private new string name;
    [SerializeField] private string Stl;
    public AudioClip SoundToPlay;
    private new readonly AudioSource audio;
    void OnGUI()
    {
        name = GUI.TextField(new Rect(10, 10, 200, 50), name);
        if (Input.GetKey(KeyCode.KeypadEnter))
        {
            NextScene();
        }
    }
        void NextScene()
        {
            audio.PlayOneShot(SoundToPlay);
            SceneManager.LoadScene(Stl);
        }
    
}

It would really help if could answer this thank you if you do.

First of all, like @ShadyProductions mentions, you are not actually doing anything with the data that is provided by the GUI.Textfield. So its not really a case of “having trouble” its more like not doing anything. The value will not magically appear somewhere in a script because you made a textfield. The value needs to be assigned to something, maybe a gameobject, maybe a file that doesn’t get reloaded while changing scene.

So to make it work: assign the value to something useful and create/use a script that can transfer data from one scene to another, otherwise the data is lost anyway.