Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 07 Jun 2015 06:59 PM |
What would you use to fire the script?
Like, GetKeysPressed() returns an array of the keys currently being pressed.
This is what I have, but it doesn't work.
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService") UIS.InputBegan:connect(function() local keysPressed = UIS:GetKeysPressed() for i,v in pairs(keysPressed) do if v == "f" then print('Fired') end end end) |
|
|
| Report Abuse |
|
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 07 Jun 2015 07:08 PM |
| Oh wait, the problem might be that it's in KeyCodes... |
|
|
| Report Abuse |
|
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 07 Jun 2015 07:09 PM |
I changed if v=="f" then to 'if v==102 then'
still doesn't work ;P |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 07 Jun 2015 07:12 PM |
It returns the actual inputObjects.
--
local UIS = game:GetService("UserInputService") UIS.InputBegan:connect(function() local keysPressed = UIS:GetKeysPressed() for i,v in pairs(keysPressed) do if v.KeyCode.Name == "F" then print('Fired') end end end) |
|
|
| Report Abuse |
|
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
| |
|
Lacrase
|
  |
| Joined: 14 Jan 2015 |
| Total Posts: 12706 |
|
| |
|