Why do I double jump when I hold spacebar?
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.
01 | local UserInputService = game:GetService( "UserInputService" ) |
03 | local LocalPlayer = game:GetService( "Players" ).LocalPlayer |
07 | local DoubleJump = false |
10 | UserInputService.JumpRequest:connect( function () |
11 | if not Character or not Humanoid or not Character:IsDescendantOf(workspace) or Humanoid:GetState() = = Enum.HumanoidStateType.Dead then |
18 | if not DoubleJump and Humanoid:GetState() = = Enum.HumanoidStateType.Freefall then |
19 | local torso = Character:FindFirstChild( "Torso" ) |
22 | torso.Velocity = Vector 3. new(torso.Velocity.X, Humanoid.JumpPower * 1.5 , torso.Velocity.Z) |
33 | local function CharacterAdded(char) |
35 | Humanoid = char:WaitForChild( "Humanoid" ) |
37 | Humanoid.StateChanged:connect( function (_, new) |
38 | if new = = Enum.HumanoidStateType.Landed then |
43 | Humanoid.Died:connect( function () |
48 | if LocalPlayer.Character then |
49 | CharacterAdded(LocalPlayer.Character) |
52 | LocalPlayer.CharacterAdded:connect(CharacterAdded) |