Functions Not Recognised

Hi, my functions do not work and they keep working then not working. It wants me to add semicolons where I start the function, and it wants me to add brackets to where I already have them.
This is my script:

function CalculateFireRate () {
	MagSize=CurrentAmmo;
	ShotsPerSecond= ShotsPerMinute/60;
	fireDelayCalculator= ShotsPerSecond*100;
	fireDelay= 100/fireDelayCalculator;
}

function OnGUI () {
	AmmoText.text = "Ammo: " + CurrentAmmo + "/" +  MaxAmmo.ToString();
	FireRateText.text = "Fire Rate: " + FireRate;
}

As general rule: If you have a compiler error, the error has to be exactly where the error points to or before. It’s never after that point. “Before” can mean right at the start of your script. Wrong brackets can “carry” that error downwards in your script because it is first detected when the compiler stumbles on something that doesn’t make sense at that point.

Hi, I’ve fixed it by running over the script a few times :slight_smile: