Hey I am making a very basic FPS game for a university project in javascript and I am currently stuck on how to make my score counter. I am using a raycast for my shooting and that is what I want to attach my code to. I want the score to display on screen and increase by 100 when the raycast hits a rigidbody. I have a few lines of code that I found on unity answers and have changed the variables to my own, this is only a very small amount but can anyone help me please.
var score : int;
var Counter : GUIText;
function OnHit {
if(Hit.rigidbody){
score += 1;
Counter.text = ("Score: ") +score;
}