Sorry the script is so long but I really need help. This script works almost perfectly apart from the fact that you can double jump just by holding spacebar, its really annoying and I dont know how to fix this since you're meant to have to double tap the spacebar to perform a double jump. If you need anymore information please please comment.
Theres an article about this script here
Thank you in advance.
local UserInputService = game:GetService("UserInputService")
local LocalPlayer = game:GetService("Players").LocalPlayer
local Character
local Humanoid
local DoubleJump = false
local Debounce = false
UserInputService.JumpRequest:connect(function()
if not Character or not Humanoid or not Character:IsDescendantOf(workspace) or Humanoid:GetState() == Enum.HumanoidStateType.Dead then
return
end
if not Debounce then
Debounce = true
if not DoubleJump and Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
local torso = Character:FindFirstChild("Torso")
if torso then
torso.Velocity = Vector3.new(torso.Velocity.X, Humanoid.JumpPower * 1.5, torso.Velocity.Z)
DoubleJump = true
end
end
wait(0.3)
Debounce = false
end
wait(5)
end)
local function CharacterAdded(char)
Character = char
Humanoid = char:WaitForChild("Humanoid")
Humanoid.StateChanged:connect(function(_, new)
if new == Enum.HumanoidStateType.Landed then
DoubleJump = false
end
end)
Humanoid.Died:connect(function()
DoubleJump = false
end)
end
if LocalPlayer.Character then
CharacterAdded(LocalPlayer.Character)
end
LocalPlayer.CharacterAdded:connect(CharacterAdded)

1 comment
This is because JumpRequest fires repeatedly while the spacebar is held.