C# Curly Brace Error

I keep getting a “} expected error” when as far as I can tell I have the proper number of curly braces. I get the first error at the Update and then another at the if statement. I am rather new to coding so any help would be much appreciated

using UnityEngine;
using System.Collections;

public class MomsLetter : MonoBehaviour 
{
	public string letter = "Teste test test";
	
	void Update () 
	{
		void onTriggerStay(Collider other)
		{
			if (other.tag == "Player")
			{
				void OnGUI()
				{
					letter = GUI.TextField(new Rect(10, 10, 200, 20), letter);
				}
			}
		}
	}
}

Because you’re doing it completely wrong. Shortly - function cannot be created in that manner inside the other function, you can call it inside the function if needed. And so the correct way would be:

using UnityEngine;
using System.Collections;

public class MomsLetter : MonoBehaviour
{
    public string letter = "Teste test test";

    void Update()
    {

    }
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {

        }
    }
    void OnGUI()
    {
        letter = GUI.TextField(new Rect(10, 10, 200, 20), letter);
    }
}

But most likely considering what you supposedly tried to do, you want this:

using UnityEngine;
using System.Collections;

public class MomsLetter : MonoBehaviour
{
    public string letter = "Teste test test";
    private bool rdy = false;
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player") rdy = true;
    }
    void OnGUI()
    {
        if(rdy) letter = GUI.TextField(new Rect(10, 10, 200, 20), letter);
    }
}

P.S. And just for the sake of completeness, this is how you call function from the other function:

void Update()
{
    Something();
}
void Something()
{
    Debug.Log("Something");
}