Not getting component properly

How do I fix this so that script 1 gets the string of script 2 (names) and sets it as string dis.

script 1

private string dis;
 
function Update()
{
    RaycastHit hit;
    		Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    		if (Physics.Raycast(ray, out hit))
    		{
    			if(hit.collider.gameObject.tag == "name")
    			{
    				Sink h = hit.collider.gameObject.GetComponent<Sink>();
    				go = true;
    				h.names = dis; 
    			}
}

script 2

public class Sink : MonoBehaviour 
{
	public string names = "Press F to toggle the sink";
}

You’re on the right track, but you’re actually doing it the wrong way:

instead of

h.names = dis;

You should have :

dis = h.names;

The left hand side of the Equal operator (=) is the one getting the value.

the value you want to assign is on the right hand side of the operator.