my goal was to create a code that would allow a player to double jump, but it didnt end up working. Any ideas? THANKS.
while workspace.Gamestart == true do local FirstJump = false local MidJump = false local Mouse = script.Parent.Parent:GetMouse() function onKeyDown(key) if string.byte(key) == 32 and FirstJump == true and (MidJump == false or script.Creative.Value == true) then MidJump = true script.Parent.Parent.Character.Torso.Velocity = Vector3.new(0,50,0) end end function Update() if script.Parent.Parent.Character.Humanoid.Jump == true then FirstJump = true else FirstJump = false MidJump = false end end Mouse.KeyDown:connect(onKeyDown) script.Parent.Parent.Character.Humanoid.Changed:connect(Update) end
If you don't find a solution here is a script
Make a localscript in StarterPack, and insert this into the localscript, then insert a Boolvalue into the localscript and name it "Jump" leave the boolvalue unchecked
I hope this helped!
repeat wait() until game:GetService("Players") local Player = game.Players.LocalPlayer repeat wait() until Player local FirstJump = false local MidJump = false local Mouse = Player:GetMouse() bruh = false function onKeyDown(key) if string.byte(key) == 32 and FirstJump == true and not bruh and (MidJump == false or script.Jump.Value == true) then bruh= true MidJump = true Player.Character.Torso.Velocity = Vector3.new(0,50,0) -- Change here to change how high you jump, Player.Character.Humanoid.WalkSpeed = 16 wait(1.1) bruh = false end end -- Please do not change below function Update() if Player.Character.Humanoid.Jump == true then FirstJump = true else FirstJump = false MidJump = false Player.Character.Humanoid.WalkSpeed = 16 end end Mouse.KeyDown:connect(onKeyDown) Player.Character.Humanoid.Changed:connect(Update)