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

Stops working/Takes longer to receive input?

Asked by
drahsid5 250 Moderation Voter
11 years ago

Hi, I'm making a double-jump script, and it seems to work fine- for the first jump-or-so. then it takes longer to preform the second jump, make the second jump trigger randomly, etc. I think it has something to do with the "jump" variable.

This seems to stop working, or at lest take longer to do the function, can anyone tell me how to fix it?

01repeat wait(0.25) until game.Players.LocalPlayer
02local Plr = game.Players.LocalPlayer
03local Mouse = Plr:GetMouse()
04local Character = Plr.Character
05jump = 0
06Character.Humanoid.Jumping:connect(function(jumping)
07Character.Humanoid.FreeFalling:connect(function(fall)
08Mouse.KeyDown:connect(function(Key)
09repeat wait() until fall == false and jumping == false and jump == 0 or Key:byte() == 32 and fall == true and jump ~= 2
10if Key:byte() == 32 and fall == true or jump == true and jump ~= 2 then
11Character.Torso.Velocity = (Vector3.new(0,55,0))
12jump = 2
13Key = nil
14wait(3)
15if jump == 2 or jump == 1 then jump = 0 end
View all 26 lines...

1 answer

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
11 years ago
01repeat wait() until game.Players.LocalPlayer
02local db = true
03local down = false
04local p = game.Players.LocalPlayer
05 
06 
07local firstClick = 0
08local db = true
09 
10p:GetMouse().KeyDown:connect(function(key)
11    if key:byte() == 32 and db then
12        if firstClick == 0 then
13            firstClick = tick()
14        elseif firstClick ~= 0 then
15            calc = (tick() - firstClick)
View all 26 lines...
0
There is an infinite loop in here somewhere that crashed the playsolo. lol. drahsid5 250 — 11y
0
repeat wait() until game.Players.LocalPlayer --Maybe you didn't put it in a LocalScript? Event then, that wouldn't cause a crash. Maybe you have another script causing it. Azarth 3141 — 11y
0
I put "wait()"'s at the ends and it worked. Thanks! drahsid5 250 — 11y
Ad

Answer this question