Stop double jumping when using a Jump pad

Hey, I have a game in which a player can use a jump pad to get a boost into the sky. I have a double jump and dash function also implemented. sometimes when you use the jump pad the player automatically double jumps, I think this is because I am detecting when the player hits the jump pad.

here is a video link that shows the problem:


local pad = script.Parent

local config = script.Parent:FindFirstChild("Configure")

function jump(hit)
	
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		
		local hum = hit.Parent:FindFirstChild("Humanoid")
		local trail = config:FindFirstChild("JumpPadDust"):Clone()
		trail.Parent = hit.Parent:FindFirstChild("HumanoidRootPart")
		
		hum.JumpHeight = 80
		hum.Jump = true
		wait(0.1)
		hum.Jump = false
		hum.JumpHeight = 7.2 
		wait(0.5)
			trail:Destroy()
			end
	end


pad.Touched:Connect(jump)

This is my first post on the dev forum :slight_smile:

How can I go about stopping the second jump from happening automatically? I only want players to be able to double jump when they press the spacebar.

use debounce to fix it so it will stop double jumping

Thanks man, I’m surprised I have not heard of this until now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.