How do I make when a player presses a mouse button they take no damage

How do I make when a player presses a mouse button they take no damage

2 Likes

They shouldnt take damage anyway… Unless u scripted that.

So when a player clicks, they become invincicble?

You could use UserInputService (UserInputService | Roblox Creator Documentation)

And when the player clicks their left mouse button, they receive a forcefield (ForceField | Roblox Creator Documentation)
or you change their Health & MaxHealth to math.huge, which essentially gives them ‘infinite’ HP!

2 Likes

Yes but only for a certain time so when they hold down on right mouse click they become invincible and when they stop pressing the button they become normal

You could make it so that whenever the mouse’s click input has begun, you will store their previous HP and set it to math.huge as said before, or give them a forcefield. Once the input has ended, remove the forcefield or restore their previous HP.

1 Like