xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 25 Mar 2016 05:52 PM |
im trying to add a debounce in the inputended function so it doesnt fire when the inputbegan is on a "cooldown" but im failing at it
local deb = false local req = 5 uis.InputBegan:connect(function(input, GPE)--InputBegan if GPE then return end if input.KeyCode == Enum.KeyCode.E then if deb == true then print 'cooling' return end deb = true wait(5) deb = false print 'cooled' end end)
uis.InputEnded:connect(function(input)--InputEnded if input.KeyCode == Enum.KeyCode.E then print(req) end end)
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$11,030 Tx70 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2016 05:56 PM |
local deb = true local req = 5 uis.InputBegan:connect(function(input, GPE)--InputBegan if GPE then return end if input.KeyCode == Enum.KeyCode.E then if deb == false then print 'cooling' return end deb = false wait(5) deb = true print 'cooled' end end)
uis.InputEnded:connect(function(input)--InputEnded if input.KeyCode == Enum.KeyCode.E then print(req) end end)
see if this works |
|
|
| Report Abuse |
|
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 25 Mar 2016 06:05 PM |
i dont see the difference
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$11,030 Tx70 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 25 Mar 2016 06:36 PM |
local uis = game:GetService("UserInputService") local debounce = false local req = 5
uis.InputBegan:connect(function(input) --InputBegan if input.KeyCode == Enum.KeyCode.E then if not debounce then debounce = true print("Cooling") wait(5) debounce = false print("Cooled") end end end)
uis.InputEnded:connect(function(input) --InputEnded if input.KeyCode == Enum.KeyCode.E and not debounce then print(req) end end) |
|
|
| Report Abuse |
|
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 26 Mar 2016 06:29 PM |
keeps printing and printing
sorry for my ugly code
local req = 0 --Setting default value local LCV --make LCV nill local deb = false --InputBegan Debounce local deb1 = false --InputEnded debouncce uis.InputBegan:connect(function(input, GPE) if GPE then return end if input.KeyCode == Enum.KeyCode.E then if not deb then deb = true req = 0 LCV = true local human = char.Humanoid ani.AnimationId = "http://www.roblox.com/asset?id=387149840" if human then local load = human:LoadAnimation(ani) if load then load:Play() end end while LCV do wait(1) req = req + 1 print 'added 1' end wait(2) deb = false print 'cooled' end end end)
uis.InputEnded:connect(function(input)--Aftet button was released if input.KeyCode == Enum.KeyCode.E and not deb then LCV = false print(req) ani.AnimationId = "http://www.roblox.com/asset?id=387152305"
local hu = char.Humanoid if hu then local load = hu:LoadAnimation(ani) if load then load:Play() wait(2) load:Stop() end end end end)
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$10,967 Tx140 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 26 Mar 2016 08:03 PM |
some end my madness
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$11,002 Tx140 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 26 Mar 2016 11:18 PM |
END MY SUFFERING I FEEL LIKE A LOSER RIGHT NOW PLS
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$11,002 Tx140 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 26 Mar 2016 11:38 PM |
yes i did
it kept printing over and over
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$11,002 Tx140 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|