set ray.point as x, y and z float

Hi! i am trying to get the x, y and z cordinates from a ray into a public float. the script looks like this:

using UnityEngine;
using System.Collections;

public class RaytoMouse : MonoBehaviour {

	public float distance = 50f;
	public float x = 0;
	public float y = 0;
	public float z = 0;
	//replace Update method in your class with this one
	void FixedUpdate () 
	{    
		//if mouse button (left hand side) pressed instantiate a raycast
		if(Input.GetMouseButton(0))
		{
			//create a ray cast and set it to the mouses cursor position in game
			Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
			RaycastHit hit;
			if (Physics.Raycast (ray, out hit, distance)) 
			{
				//draw invisible ray cast/vector
				Debug.DrawLine (ray.origin, hit.point);
				//log hit area to the console
				Debug.Log(hit.point);
				
			}    
		}    
	}
}

my question would be, how can i fill the public float x, y and z to the right coordinates? the debuging already works fine.

A Ray doesn’t have a point variable. I assume you mean the point variable of the Hit type of class.

if (Physics.Raycast (ray, out hit, distance)) 
             {
                 //draw invisible ray cast/vector
                 Debug.DrawLine (ray.origin, hit.point);
                 //log hit area to the console
                 Debug.Log(hit.point);
                  x = hit.point.x;
                  y = hit.point.y;
                  z = hit.point.z;
                 
             }