I have a combat script but i want it to loop so player left clicks on monster then he attacks it then monster attacks back and repeat until either player or monster is dead or player runs away i have it almost completed but my problem is the player will only attack once until you left click again on the monster how can i make it where when the player left clicks the first time it would keep going?
- Fixed added a bool isAttacking (Read Jeffreyschoch’s post below)
Please use Code Tags when pasting code into the forums.
You can use “GetKey” instead of “GetKeyDown” and it will check if the key is held down currently.
Ok sorry i updated my post but i don’t want the player to have to hold left click when in combat, would like for it to be pressed once then go from there if you know what i mean.
Then OnKeyDown set a boolean like “Attacking” to true. Then each attack interval check that boolean is true and continue the attack if it is. Set the boolean back to false whenever they should stop the autoattacking.
Alright well seems to be working thank you.
1 Like