|
| 19 Mar 2015 03:31 PM |
| for example when I press the "E" key on the keyboard |
|
|
| Report Abuse |
|
|
iondriver
|
  |
| Joined: 18 Nov 2012 |
| Total Posts: 757 |
|
|
| 19 Mar 2015 03:35 PM |
function IHAVEBEENCALLEDYEAH () local MOUSEOFAWSOMETOWN = game.Players.LocalPlayer:GetMouse() print("IHAVEBEENCALLEDYEAH!") end
function KEYMASTEROFHISPANOLA (key) if key == "e" then IHAVEBEENCALLEDYEAH () end end
MOUSEOFAWSOMETOWN.KeyDown:connect(KEYMASTEROFHISPANOLA) |
|
|
| Report Abuse |
|
|
iondriver
|
  |
| Joined: 18 Nov 2012 |
| Total Posts: 757 |
|
|
| 19 Mar 2015 03:35 PM |
Wait I messed up
local MOUSEOFAWSOMETOWN = game.Players.LocalPlayer:GetMouse() function IHAVEBEENCALLEDYEAH () print("IHAVEBEENCALLEDYEAH!") end
function KEYMASTEROFHISPANOLA (key) if key == "e" then IHAVEBEENCALLEDYEAH () end end
MOUSEOFAWSOMETOWN.KeyDown:connect(KEYMASTEROFHISPANOLA)
there we go. |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 19 Mar 2015 03:35 PM |
You're going to have to define the mouse:
local mouse = game.Players.LocalPlayer:GetMouse()
Then this old thing:
mouse.KeyDown:connect(function(key) if key=="e" then --check if the key is 'e' print("E has been pressed") end end) |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2015 03:36 PM |
mouse.KeyDown is deprecated.
Use "UserInputService" instead. |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 19 Mar 2015 03:37 PM |
| I'm not used to the new stuff, I've always used KeyDown |
|
|
| Report Abuse |
|
|
| |
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
| |
|
iondriver
|
  |
| Joined: 18 Nov 2012 |
| Total Posts: 757 |
|
|
| 19 Mar 2015 03:38 PM |
| Never used it. Could you explain how? |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 19 Mar 2015 03:40 PM |
| http://wiki.roblox.com/index.php?title=Userinputservice |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2015 03:40 PM |
| http://wiki.roblox.com/?title=API:Class/UserInputService |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 19 Mar 2015 03:41 PM |
local User = game:GetService("UserInputService")
User.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.K then print("K") end end)
I script -~ chimmihc |
|
|
| Report Abuse |
|
|