Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This double jump script won't work?

Asked by 8 years ago

I've been working on a platformer, but for some reason this script lags a lot in the server.


deb=false J1=false J2=false mouse=script.Parent.Parent:GetMouse() plyr=script.Parent.Parent repeat wait() until plyr.Character plyr.Character.Humanoid.WalkSpeed=24 local function onKeyDown( key ) print("Key:", key, " Code:", string.byte(key)) if key==" " and plyr.Character.Torso.Velocity.Y~=0 and J1==true and plyr.Character.Humanoid.Jump==true and deb==false then deb=true plyr.Character.Torso.Velocity=Vector3.new(0,50,0) script.Sound:Play() J2=true wait(1.1) deb=false end end mouse.KeyDown:connect(onKeyDown) function D() if plyr.Character.Humanoid.Jump==true then J1=true end end plyr.Character.Humanoid.Changed:connect(D) while wait() do if plyr.Character.Torso.Velocity.Y==0 then J1=false end end

Help is appreciated.

1 answer

Log in to vote
-2
Answered by 8 years ago

I'm only going to help you with double jump

jumping = plyr.Character.Humanoid.Jump == true

while true do
wait()
    if jumping then
        for i = 1,1 do
            plyr.Character.Humanoid.Jump = false
        wait(.1)
            plyr.Character.Humanoid.Jump = true
    end
end

This is only the part for the double jump. If it doesn't work, please let me know!

Ad

Answer this question