Need help to modify this script!

Hi,i made script for my game,but now im bit confused,ibecause i did not everything bedore…Now i dont know how to do that.
So what i just need is : when raycast hits player then print(“massage”); and thats all (Without deleting anything from this script)
Can anyone help me,Please? Thanks. :slight_smile:

#pragma strict

var hitInfo			: RaycastHit;

var Layers			: LayerMask = -1;
var TrigerLayers	: LayerMask = -1;

var tr				: Transform;
var Distance		: float;

var BeamActive 		: boolean;

function Awake () {
	tr			= transform;
}

function Update () {
	if (!BeamActive) 
		return;
		
	// Cast a ray to find out the end point of the laser
	if (Physics.Raycast (tr.position, tr.up, hitInfo, Mathf.Infinity, Layers)) {
		Distance = hitInfo.distance;
		
		var hits : RaycastHit[];
		hits = Physics.RaycastAll (tr.position, tr.up, Distance, TrigerLayers);
		
 		for (var i = 0; i < hits.Length; i++) {
        	var hit : RaycastHit = hits[i];
			hit.transform.gameObject.SendMessageUpwards('Lightened', null, SendMessageOptions.DontRequireReceiver);
    	}		
	}
}

function GetHitInfo () : RaycastHit {
	if (!BeamActive) {
		hitInfo.distance = 0.0;
	}
	
	return hitInfo;
}

function ForceRaycast() {
	if (!BeamActive)
		return;
	
	Physics.Raycast (tr.position, tr.up, hitInfo, Mathf.Infinity, Layers);
}

function UpdateObject(Active : boolean) {
	BeamActive = Active;
	
	if (!Active)
		hitInfo.distance = 0.0;
}

emmm,can anyone help?

This impatience…
Add a tag called ‘Player’ to your player object and check for that tag after your raycast has it something.

Tag is already added to my player,i just dont knw where to put that line where it detects player and prints ("massage’); or other actions,can you please modify my script???

Have a look here in the bottom section.