FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 28 Oct 2014 07:11 PM |
1. Debounce will not work properly 2. "keydown" stays down forever after you press once
newspeed = 30 oldspeed = 16 player = game.Players.LocalPlayer mouse = player:GetMouse() keydown = false stamina = script.Parent debounce = false
mouse.KeyDown:connect(function(key) debounce = true if key == "q" then keydown = true if keydown == true then player.Character.Humanoid.WalkSpeed = newspeed stamina.Size = stamina.Size + UDim2.new(-0.01,0) else player.Character.Humanoid.WalkSpeed = oldspeed stamina.Size = stamina.Size + UDim2.new(0,0) wait(5) debounce = false end end end) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:14 PM |
You have no condition checking against your debounce You need to set your mousedown to false on mouseup |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:14 PM |
Keydown, I meant. On keyup. Bleh |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 28 Oct 2014 07:16 PM |
You have no condition checking against your debounce
?? |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 28 Oct 2014 07:18 PM |
oh, but its still not working.
newspeed = 30 oldspeed = 16 player = game.Players.LocalPlayer mouse = player:GetMouse() keydown = false stamina = script.Parent debounce = false
mouse.KeyDown:connect(function(key) if debounce == true then return end debounce = true if key == "q" then keydown = true if keydown == true then player.Character.Humanoid.WalkSpeed = newspeed stamina.Size = stamina.Size + UDim2.new(-0.01,0) wait(1) keydown = false else player.Character.Humanoid.WalkSpeed = oldspeed stamina.Size = stamina.Size + UDim2.new(0,0) wait(5) debounce = false end end end) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:20 PM |
| Your entire if keydown statement is obsolete |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 28 Oct 2014 07:23 PM |
| How? Could you just try fixing the scripts? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:28 PM |
| Nope, because I'm on my tablet and not in the mood for being helpful. |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 28 Oct 2014 07:31 PM |
Oh, alright :/
But could you tell me where I went wrong? I dont understand |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:37 PM |
| Keydown is gauranteed to be true by the time the if statement comes. This makes the else block obsolete, and the entire statement. |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 28 Oct 2014 07:41 PM |
okay, now whats wrong. same problems
mouse.KeyDown:connect(function(key) if debounce == true then return end debounce = true if key == "q" then if keydown == false then keydown = true player.Character.Humanoid.WalkSpeed = newspeed stamina.Size = stamina.Size + UDim2.new(-0.01,0) wait(1) keydown = false wait(5) debounce = false end end end) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:45 PM |
| Your if keydown statement is redundant. |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:51 PM |
| Your debounce stole its job. |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 28 Oct 2014 07:55 PM |
still wont work:
newspeed = 30 oldspeed = 16 player = game.Players.LocalPlayer mouse = player:GetMouse() stamina = script.Parent debounce = false
mouse.KeyDown:connect(function(key) if debounce == true then return end debounce = true if key == "q" then player.Character.Humanoid.WalkSpeed = newspeed stamina.Size = stamina.Size + UDim2.new(-0.01,0) wait(5) debounce = false end end) |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2014 07:58 PM |
UDim2s take 4 values I thought?
stamina.Size = stamina.Size + UDim2.new(-0.01, 0, 0, 0) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 07:58 PM |
| You never set your walkspeed back to oldspeed |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2014 07:59 PM |
| Also, you are turning debounce on if debounce is off, but only turning debounce back off if the key was Q. That means that if any other key is pressed, it turns debounce on permanently. |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Oct 2014 08:15 PM |
XD You should have done it UNIX style. |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
| |
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
| |
|
|
| 29 Oct 2014 03:37 PM |
| "Also, you are turning debounce on if debounce is off, but only turning debounce back off if the key was Q. That means that if any other key is pressed, it turns debounce on permanently." -JarodOfOrbiter |
|
|
| Report Abuse |
|
|
FlameYeti
|
  |
| Joined: 14 Jan 2009 |
| Total Posts: 22158 |
|
|
| 29 Oct 2014 03:43 PM |
Okay, now still two problems. If you press down Q, then you only sprint for a second and then the GUI only goes down once even if you hold Q down for 20 seconds or more.
newspeed = 30 oldspeed = 16 player = game.Players.LocalPlayer mouse = player:GetMouse() staminabutton = script.Parent stamina = 0 keydown = false
mouse.KeyDown:connect(function(key) if key == "q" then keydown = true while keydown == true do player.Character.Humanoid.WalkSpeed = newspeed staminabutton.Size = staminabutton.Size + UDim2.new(-0.01, 0) wait(1) player.Character.Humanoid.WalkSpeed = oldspeed keydown = false end end end) |
|
|
| Report Abuse |
|
|