How to detect if a key (Left click) is held and released

Hey, I can detect when a key is pressed with player.KeyPressed(), but player.KeyReleased() doesn’t seem to work, or I’m doing it wrong.

I’m trying to make it so that holding down the fire button will give you an effect (like lower gravity, increased health, etc.) but pressing the key seems to not work. If I try to set gravity on a player while holding down the key, I can’t get it to have any effect. Any idea? Or am I going about this the wrong way.

Use theses functions KeyPressed and KeyReleased

… did you read the first sentence?

Post the code you have.

I don’t really have any code. I tried ply:KeyReleased and it wouldn’t return anything, not even a print function. At this point I’m just kind of stuck

Probably because you are using it incorrectly.

[editline]10th October 2013[/editline]

Oh, considering the title, ply:KeyReleased is not working for mouse events.

[editline]10th October 2013[/editline]

This looks excellent, thanks :slight_smile: