drop health every fifth second

Hey, I would like to know how to drop your health down every fifth second.

I’ve figured out that it’s in the update I must fix the script, but how?

Maybe there is a better solution but try this:

private var timeDifference = 0.0;

function Update () {
	timeDifference += Time.deltaTime;
	
	if(timeDifference >= 5) {
		timeDifference = 0;
		DropHealth();
	}
}

forgot to mention it is C sharp I’m working in, I’m a beginner so I don’t know if it was c sharp you answered in

HEY! It worked! thanks alot! : D