Xucs
|
  |
| Joined: 23 Jul 2010 |
| Total Posts: 11844 |
|
|
| 21 May 2015 01:32 PM |
Both of us are fairly new to scripting, and even newer to keydown functions. I know how to check if a key is pressed; while key:lower"x" or something, but how would you change this into being WHILE shift is being held, this is happening.
mouse.KeyDown:connect(function(key) if key:lower()=="x" then --This is where it needs to be changed, I believe. wait(.1)
This is a fragment of the script, it won't allow me to post the whole thing.
Leveraged/tixmaker101 + 55k posts | |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 21 May 2015 01:35 PM |
mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key) if key:lower() == "x" then --enable what to happen end end)
mouse.KeyUp:connect(function(key) if key:lower() == "x" then --disable what to happen end end) |
|
|
| Report Abuse |
|
|
Intern33t
|
  |
| Joined: 19 Nov 2010 |
| Total Posts: 1530 |
|
|
| 21 May 2015 01:35 PM |
local shift = false local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(key) if key.KeyCode = Enum.KeyCode.Shift then shift = true end end)
uis.InputEnded:connect(function(key) if key.KeyCode = Enum.KeyCode.Shift then shift = false end end)
function doStuff() --Do stuff while shift is held end
while wait() do if shift then repeat doStuff() wait() until not shift end end
~ᵂʰᵒ ᵃʳᵉ ʸᵒᵘ ᵗᵒᵈᵃʸ﹖~ |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 21 May 2015 01:36 PM |
or just listen to that guy above me
ive quit roblox |
|
|
| Report Abuse |
|
|
Xucs
|
  |
| Joined: 23 Jul 2010 |
| Total Posts: 11844 |
|
|
| 21 May 2015 01:37 PM |
Thanks.
We've been reading wiki articles, and didn't understand it.
Any chance you guys could post an informative link on keydowns?
Leveraged/tixmaker101 + 55k posts | |
|
|
| Report Abuse |
|
|
Intern33t
|
  |
| Joined: 19 Nov 2010 |
| Total Posts: 1530 |
|
|
| 21 May 2015 01:38 PM |
Please dont use the mouse object. Also not KeyDown and KeyUp.
Use UserInputService.
http://wiki.roblox.com/index.php?title=UserInputService
~ᵂʰᵒ ᵃʳᵉ ʸᵒᵘ ᵗᵒᵈᵃʸ﹖~ |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 21 May 2015 01:38 PM |
http://www.roblox.com/Valkyrie-Binds-Manager-item?id=235385848
local binds = require(thatThing) binds:BindInputDown('x', function(iData) while iData.Down and binds.Keys.Shift.Down do -- Do something end end); |
|
|
| Report Abuse |
|
|
|
| 21 May 2015 02:14 PM |
"Please dont use the mouse object."
No. Just no. UIS isn't good enough to entirely replace every single feature of the mouse. (yet) |
|
|
| Report Abuse |
|
|
|
| 21 May 2015 02:18 PM |
mouse = plr:GetMouse() keysdown = {}
mouse.KeyDown:connect(function(key) keysdown[key] = true end)
mouse.KeyUp:connect(function(key) keysdown[key] = false end)
while keysdown["w"] do print("you're holding w hurray!") end |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2015 10:41 PM |
| HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM... |
|
|
| Report Abuse |
|
|
|
| 30 Sep 2015 10:56 PM |
You could use this in a local script
local uI = game:GetService("UserInputService")
game:GetService("RunService"):BindToRenderStep("Name", Enum.RenderPriority.Input.Value, function() if(uI:IsKeyDown(Enum.KeyCode.RightShift) or uI:IsKeyDown(Enum.KeyCode.RightShift)) then -- Code here end end)
|
|
|
| Report Abuse |
|
|
|
| 30 Sep 2015 10:57 PM |
| I meant to put Enum.KeyCode.LeftShift instead of RightShift twice |
|
|
| Report Abuse |
|
|
Poseidas
|
  |
| Joined: 23 Nov 2008 |
| Total Posts: 2659 |
|
|
| 01 Oct 2015 12:52 AM |
"UIS isn't good enough to replace the mouse"
ha. Okay. |
|
|
| Report Abuse |
|
|