|
| 22 Aug 2017 05:57 PM |
my script: local Mouse = game. Players. LocalPlayer: Get Mouse()
local notes = {q = "A"}
Mouse. Key Down: Connect( function (key) for i, v in pairs (notes) do if key == v then print( v ) end end end)
spaces due to the filter. basically what I need it to do is when you click the letter q on your keyboard it will return what q equals which is A but it's not printing anything I need help.
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 22 Aug 2017 05:58 PM |
local notes = {["q"] = "A"}
Mouse. Key Down: Connect( function (key) for i, v in pairs (notes) do if key == i then print( v ) end end end)
|
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 22 Aug 2017 05:58 PM |
| UserInputService or ContextActionService not Keyboard input, get up to date you baka |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:07 PM |
Now how would I accomplish that with multiple keys? For ex: if you press both q and w it will print the value of those combined? example table: local table = {a and w together equal T}
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 22 Aug 2017 06:08 PM |
mk well Im pretty sure no one is going to press a key at the EXACT frame as another.
So you'd need some wait times and stuff |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:11 PM |
I mean if you click the letter r and while still holding it down you click another letter and hold both of those letters down
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:15 PM |
UserInputService has a function that can help with that.
|
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:35 PM |
good
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:42 PM |
Like everyone else says, use UIS(UserInputService) And do like game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.Q) and (same thing here but different letter)
getfield(lua_State, -1, "MemeService") |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:48 PM |
Y eah I got it to work using User Input Service. But how would I add more than one combination to the table? EX: I need it to say local table = {a and b together = c, a = g}
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:51 PM |
thats kinda hard the way youre doing it but heres mutiple
local uis = game:GetService("UserInputService")
function doStuff() --stuff here end
if uis:IsKeyDown(Enum.KeyCode.Q) and uis:IsKeyDown(Enum.KeyCode.R) then doStuff() end)
getfield(lua_State, -1, "MemeService") |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:52 PM |
I would rather do it in a table so I don't have a billion of those thingys
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:56 PM |
so I couldn't do something like local table = {["a, b"] = "bee"}?
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 06:58 PM |
You could, but then you would still need a way of binding it.
|
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 07:02 PM |
Well ehhh could I have some help on multi key combinations? I already know how I could do it Is key type(that table value one) and (that table value two) --not right at all but you get the point I just need a way to put the letter combinations in a table
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 07:04 PM |
I guess i would set up the values in the table then check if it's a double combination somehow and if it is it will do the special stuff
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
ahwz
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 3230 |
|
|
| 22 Aug 2017 07:23 PM |
this is a vid of it working. I tried to demostrate that it works when you press leftshift and L at single times and it only runs the function from the combos table if both are pressed.
streamable . com / b5vro desperately tried to post the code but couldn't try to uncensor the code.
pastbin /ZiVs8ejQ
|
|
|
| Report Abuse |
|
|
ahwz
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 3230 |
|
|
| 22 Aug 2017 07:27 PM |
The format would be
local combos={ [Enum.KeyCode.KEY0.Name.."+"..Enum.KeyCode.KEY1.Name]=function(args) --code end; } this is the same as
local combos={ ["KEY0+KEY1"]=function(args) --code end; }
Takes advantage of IsKeyDown dynamically. Might be errors for other keycodes? Only tried for one and it worked great.
|
|
|
| Report Abuse |
|
|
|
| 22 Aug 2017 07:34 PM |
Any way I could just put something like this for it?: local tabled = {[a and b] = "g"}
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|
ahwz
|
  |
| Joined: 01 Apr 2010 |
| Total Posts: 3230 |
|
|
| 22 Aug 2017 07:37 PM |
this would be valid with my system.
local combos={ ["A+B"]=function() print("g") end; }
|
|
|
| Report Abuse |
|
|
|
| 23 Aug 2017 03:54 PM |
actually.... A friend helped me out a little with this... I just did: local table = {["g"] = {Key Down A, Key Down B}} and all that stuff
repeat print("Muffin is cool") until Muffin_is_way_too_cool == true |
|
|
| Report Abuse |
|
|