How to Make Jumping Script that Only Jumps if On Ground?

PlayCanvas 3D HTML5 Game Engine is the link. I already know how to make the player/character jump, but it can jump while in air (so it can do double jump and beyond). Reply/comment with a script that makes it so the player/character can only jump while it is on the ground.

Cast a ray down from the center of the player to slightly below where the ground will be, that ignors the player entity of course, and if the raycast hits something named “ground” enable the ability to jump.

I personally use collisions, but that works too,

collisions can get quite jittery for whatever reason.

That’s fair.

I said script

@Markus_Jockell While you may want to get a drop in replacement for the script, the steps from Alucard will help. If there’s something you don’t fully understand, do ask and try to implement the logic yourself.

In fact I did this exact thing before, as in I checked above the player with several raycasts (actually it was one raycast just rotated multiple times) to see if the player can stand from crouching,

And I said “cast a ray”