MiniGame God of War

Hello guys.

Any one knows how to make a minigame like the god of war, when we need to press the right button right on time
to pass the challenge?

You mean the one with the naked women right? Ho ho ho.But anyway. I would think you’d need something that would attach as a listener during the update function. maybe something like this? I haven’t tested this. And i’m pretty sure there’s a better way to do it. Maybe throw it in a function of some kind. I dunno. But this was just me typing out of my butt.

var timer:Time;
var gamestart : boolean = false;
function update(){
	if(!gamestart){
		timer = Time.time + 5;
		gamestart = true;
	}
	
	if(Input.GetKey(Keycode)  (timer > Time.time)){
		print("win");
		gamestart = false;
	}
	else if(Time.time > timer){
		print("lose");
		gamestart = false;
	}
}