|
| 28 Dec 2015 02:10 PM |
How do I make it so that when I double tap space and hold down, something happens, for now it can just print something. This is my failed attempt:
local UIS = game:GetService("UserInputService") local Human = script.Parent.Parent:WaitForChild("Humanoid") local Debounce = true Human.Jumping:connect(function(Jump) if Debounce == true then Debounce = false print ("JetPack?") UIS.InputBegan:connect(function(key,GPE) if not GPE and key.KeyCode == Enum.KeyCode.Space and Human.Jump == true then print ("Jetpack!") end end) else wait(2) Debounce = true end end)
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
Phenite
|
  |
| Joined: 16 May 2010 |
| Total Posts: 158 |
|
|
| 28 Dec 2015 02:11 PM |
| Don't put the else there. That will make the wait to debounce occur after the second jump. |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2015 02:16 PM |
The whole thing is terrible. I want to not use the Jumping function. Is there a way to do this using only UIS?
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2015 02:18 PM |
Nevermind, got it: local UIS = game:GetService("UserInputService") local Human = script.Parent.Parent:WaitForChild("Humanoid")
UIS.InputBegan:connect(function(key,GPE) if not GPE and key.KeyCode == Enum.KeyCode.Space then if not GPE and key.KeyCode == Enum.KeyCode.Space and Human.Jump == true then print ("I'M FLYING!") end end end)
~IanSplodge, Walrus God of the Forums. |
|
|
| Report Abuse |
|
|