|
| 17 Oct 2013 09:04 AM |
is it possible to create a function that when you click the mouse while holding a key, it would make a function like this:
mouse.Button1Down:connect(function(key) if key == "c" then -- action here else --other action here end end) |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 17 Oct 2013 09:08 AM |
local keys = {}
mouse.Button1Down:connect(function() if keys["c"] then --action here else --other action here end end)
mouse.KeyDown:connect(function(key) keys[key] = true end)
mouse.KeyUp:connect(function(key) keys[key] = nil end) |
|
|
| Report Abuse |
|
|
chaokid9
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 6187 |
|
|
| 17 Oct 2013 09:09 AM |
This isn't proper syntax, but I would do something like this:
CDOWN = false Onkeydown() if key == "c" then CDOWN = true end
OnKeyup() if key == "c" then CDOWN = false end
OnClick() If CDOWN == true then --What you want else print("You clicked, but C was not held down") end |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 17 Oct 2013 09:14 AM |
| Ehh, yeah good logic, tho no proper syntax. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2013 09:32 AM |
| well then what is proper syntax? |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 17 Oct 2013 09:32 AM |
| You missed my first post, or what? |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2013 10:05 AM |
| no I mean, like what is the difference between your script and his script? |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 17 Oct 2013 10:11 AM |
| He had proper idea/logic, but not syntax of code. And his code would only detect one key, but I made so you can check if any other key is down, if you need it for later use. |
|
|
| Report Abuse |
|
|