enemy shoots faster as it gets closer to player

as the enemy gets closer it shoots faster… here is my script :slight_smile: (im super new and this is the first project ive done where ive used minimal tutorials)

ok so i fixed it but probably a really backwards way cos i was just testing things until it worked,
i put a bool for playerinrange as the raycast detected the player and set it to true when that happened.
than initiated the shoot() lines
than added a coroutine that wait 0.5 seconds and set the playerinrange to false.
but if the raycast it still on the player it will set the playerinrange bool to true again and repeat until the player is no longer in range.

… scale of 1 to what the f**k did you just say, how did i do