Air Jump (double jump with events)

Air Jump

This is a module for double jumping as much as you would like.

Example code:

-- in a LocalScript in StarterPlayerScripts

local AirJump = require(script.AirJump)

AirJump.AirJumped:Connect(function(currentAirJumps)
	print("Jumped while in the air. Current air jumps: "..currentAirJumps)
end)

AirJump.Landed:Connect(function()
	print("Landed")
end)

AirJump.LeftTheGround:Connect(function()
	print("Left the ground")
end)

AirJump:Start()

Showcase (using example code):

Pastebin (code has commented documentation): AirJump - Pastebin.com

Roblox model: https://www.roblox.com/library/7292071706/Air-Jump

18 Likes

Cool! How did you do the events like that?

3 Likes

If you mean how he did custom events, he uses a Signal class. :)

2 Likes

Bindable events and he did on the module
return bindableevent.Event

1 Like

Update

New:

  • Added type annotation for easy autocomplete.

Fixes:

  • Fixed bug that prevented humanoid events from registering if the character had already loaded in before :Start()ing (sorry that this wasn’t discovered sooner. I wasn’t actually using it myself when I made the new version, therefore this major mistake was overlooked).

  • Added connection cleanup for the Humanoid.StateChanged event listener.