jtefurd
|
  |
| Joined: 01 May 2010 |
| Total Posts: 952 |
|
|
| 19 Aug 2015 01:22 AM |
Is there a way to return when 2 keys are pressed at the same time? Like if you only wanted sprinting by holding shift to work when you press w, a, s, or d with it? Sorta like this?
mouse.KeyDown:connect(function(key1, key2) print(tostring(key1).." and "tostring(key2).." were pressed!") end) |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 19 Aug 2015 01:23 AM |
http://wiki.roblox.com/index.php?title=API:Class/UserInputService/GetKeysPressed
UIS > .KeyDown/.KeyUp |
|
|
| Report Abuse |
|
|
jtefurd
|
  |
| Joined: 01 May 2010 |
| Total Posts: 952 |
|
|
| 19 Aug 2015 01:24 AM |
| oh my, thank you kind sir. |
|
|
| Report Abuse |
|
|
jtefurd
|
  |
| Joined: 01 May 2010 |
| Total Posts: 952 |
|
|
| 19 Aug 2015 01:31 AM |
| Erm, having trouble attempting to just make it print the amount of keys being pressed at once. Examples anyone? qq |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 19 Aug 2015 01:38 AM |
never tried using the :GetKeysPressed() method, but i'll give it a shot
local uis = game:GetService("UserInputService") uis.InputBegan:connect(function(input, gpe) local keys = uis:GetKeysPressed() if not gpe and #keys > 0 then for i, v in ipairs(keys) do print(game.Players.LocalPlayer.Name.." has pressed "..v.KeyCode.Name) end end end)
try that? |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 19 Aug 2015 01:40 AM |
*print(game.Players.LocalPlayer.Name.." has pressed "..tostring(v.KeyCode))
no idea where .Name came from for v.KeyCode |
|
|
| Report Abuse |
|
|