I want to make a 2D action platformer game that is very similar to Super Smash Bros. It is supposed to make it so if I press "W" in midair if the player didn't double jump yet. However, I found this script for double jumping (I suck at scripting) but it only double jumps when I press space. What do I have to modify?
db=false
j=0
local plyr = game.Players.LocalPlayer
repeat wait() until plyr.Character
plyr.Character.Humanoid.WalkSpeed=24
local InputKey = "Space"
deb=false
J1=false
J2=false
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:connect(function(UserInput)
if UserInput.UserInputType == Enum.UserInputType.Keyboard then
if UserInput.KeyCode == Enum.KeyCode[InputKey] and J1==true and deb==false and j==1 and plyr.Character.UpperTorso.Velocity.Y~=0 and db==false then
j=2
deb=true
plyr.Character.UpperTorso.Velocity=Vector3.new(0,50,0)
pe=script.ParticleEmitter:Clone()
pe.Parent=plyr.Character.UpperTorso
script.Sound:Play()
wait(.3)
pe:Destroy()
J2=true
deb=false
end
end
end)
function D()
if J1==false then
db=true
J1=true
script.S2:Play()
j=1
db=false
end
end
plyr.Character.Humanoid.Jumping:connect(D)
while wait() do
if plyr.Character.UpperTorso.Velocity.Y>-.1 and plyr.Character.UpperTorso.Velocity.Y<.1 then
J1=false
j=0
end
end
Any help is appreciated!

4 comments
line 6, did you try changing that to W?
Try changing your InputKey variable to "W", or make your own script.
Wow thanks let me try it
I'm an idiot xD