problem with command

I have problem with jump…jump is infinite…I know, I know i can repair this with “grounded”…but it’s not working in my “game”. I don’t now why, but piss it.
I have an idea! I want to write a command:
Destroy Player when jump button ( getkeydown) is pressed more than 2 times in a row

But I can’t write this correct
How to write this command correct?
Please answer and Thanks!

That’s optimistic!

Hey

Great

Cruel

What’s a row in this case? Like one more time when he’s in the air, 2 times in a second or 2 times in the entire game?

Let’s pretend you answered the first one, one more time when he’s in the air, then like this:

If (Input.GetButtonDown("Jump") && Physics.CheckCapsule/CheckCube(You should fill this with the correct arguments) {
   GameObject.Destroy(playerGameObject);
   //Instantiate explosion
}

CheckCapsule or CheckCube depends on your characters dimensions, so if he’s a cube, use the latter, if he’s anything else, use the capsule

1 Like