- Home /
Help with cooldown timer
Trying to make a cooldown timer and im getting this problem Assets/FireBullet.js(9,56): BCE0051: Operator '>' cannot be used with a left hand side of type 'float' and a right hand side of type 'Object'.
var bullet:Rigidbody; var speed:int = 1; var nextbullet; var duration = 2.0;
function Update () { if (Input.GetButtonDown("Fire1")&& Time.time > nextbullet){ nextbullet = Time.time + duration;
var bulletInstance = Instantiate(bullet, transform.position, transform.rotation); bulletInstance.velocity = transform.TransformDirection (Vector3(0,0,1) * speed);
}
}
Please learn to format your question/code correctly. It's impossible to work out what line 9 of your code is… but the message basically says you are comparing a float against a variable that does not have a type, so I guess this is nextbullet
. Perhaps you meant to tell the compiler that nextbullet
was a float
?
Your answer

Follow this Question
Related Questions
Hot to solve iTween "cooldown"? 0 Answers
Delayed Cooldown 0 Answers
Cooldown button system 1 Answer
Accessing a script on another GameObject 2 Answers
How can I synchronize the cooldown on two separate scripts? 2 Answers