drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 08:36 PM |
I suck with debouncing, can someone fix it?
repeat wait() until game.Players.LocalPlayer local db = true local down = false local p = game.Players.LocalPlayer db = false
local firstClick = 0
p:GetMouse().KeyDown:connect(function(key) if key:byte() == 32 then if firstClick == 0 then firstClick = tick() db = true elseif firstClick ~= 0 then calc = (tick() - firstClick) firstClick = 0 db = false if calc >= 0 and calc <= 2.1 and db == false then p.Character.Torso.Velocity = p.Character.Torso.Velocity + Vector3.new(0,20,0) end end end end) |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
| |
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
| |
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 09:10 PM |
| I debouncing really as hard as I think? |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
| |
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 09:28 PM |
| I love when the forum helps me. :P |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
| |
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 09:48 PM |
Is this complex for you all? .-. If you didn't know; "db" is debcounce. |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 27 Feb 2014 09:54 PM |
repeat wait() until game.Players.LocalPlayer local db = true local down = false local p = game.Players.LocalPlayer
local firstClick = 0
p:GetMouse().KeyDown:connect(function(key) if key:byte() == 32 then if firstClick == 0 then if db then firstClick = tick() db = false elseif firstClick ~= 0 then calc = (tick() - firstClick) firstClick = 0 if calc >= 0 and calc <= 2.1 and db == false then p.Character.Torso.Velocity = p.Character.Torso.Velocity + Vector3.new(0,20,0) d = true end end end end end)
Something like that |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 10:05 PM |
| didn't work. But thanks for trying. ;) |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
| |
|
V0xels
|
  |
| Joined: 30 Mar 2012 |
| Total Posts: 2072 |
|
| |
|
|
| 27 Feb 2014 10:22 PM |
db = false function whatevs() if not db then --dostuff db = true wait(2) db = false else --ignorin cuz we iz waitin! end end whatevs() |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
| |
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
| |
|
|
| 27 Feb 2014 10:33 PM |
obviously u did something rong then.. the way I said it,is the way debounce is.. var = false function functionname(arguments) if var == false then var = true print "waiting 2 seconds before this can happen again" wait(2) var = false else print "wait a second!we are still waiting for var to be false!" end end
Workspace.Part.Touched:connect(functionname) |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 10:35 PM |
| The script is a double jump script, if that helps. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2014 10:36 PM |
hey,just realized Zkillers should work,but on the last line he had db spelt rong he said d = true--or false and it should've been db try fixing that last line and testing Zkillers again :) |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 10:37 PM |
| I did fix Zkiller's, nothing happened when I hit space twice. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2014 10:38 PM |
oh d@rnit.. I have no idea why it wouldn't work then.. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 10:41 PM |
xD well, if there were a method for detecting if the player is in the air, I wouldn't need this. |
|
|
| Report Abuse |
|
|
V0xels
|
  |
| Joined: 30 Mar 2012 |
| Total Posts: 2072 |
|
|
| 27 Feb 2014 10:47 PM |
Why dont you do it easy way?
local plr = game.Players.LocalPlayer local plrMouse = plr:GetMouse() local air = false
plrMouse.KeyDown:connect(function() if key == and air == false then-- Spacebar key air = true elseif key == "spacebar here" and air == true then -- Blah blah code end) |
|
|
| Report Abuse |
|
|
V0xels
|
  |
| Joined: 30 Mar 2012 |
| Total Posts: 2072 |
|
|
| 27 Feb 2014 10:48 PM |
| Add wait()'s and such to time it better. Forgot to do that |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 27 Feb 2014 10:51 PM |
| I'm bewildered in how I'd properly transfer my code to that, and why not refer to the key value I already had for space bar (32) ? |
|
|
| Report Abuse |
|
|
V0xels
|
  |
| Joined: 30 Mar 2012 |
| Total Posts: 2072 |
|
|
| 27 Feb 2014 10:52 PM |
if key:byte() == 32 and air == false then
elseif key:byte() == 32 and air == true then |
|
|
| Report Abuse |
|
|