|
| 23 Nov 2014 09:04 PM |
Hi. I'm making a LocalScript that is inside StarterGui. It is a power where you have to left-click your mouse and click "q". I already started my script but I don't know how to combine left-click and keydown... Can someone help me? Thank you in advance! :)
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key) end) |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:21 PM |
what you should do is make 2 enabled's
enabled1 = false enabled2 = false
then make it to where if the player is holding down q make enabled 1 = true then if they let go make it false and the same for the button. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:24 PM |
| It could be a solution but I don't know how to use the MouseButton1Down other than in a GUI Button... |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:27 PM |
| Some one was wondering if it's possible to use it without a gui awhile back I don't remember if he figured it out. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:29 PM |
| Well, I searched through Roblox Wiki and nothing about it... |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:31 PM |
| Hmm in a tool would be possible. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:35 PM |
Aww... It was my goal to avoid a tool... lol
I want it like in League of Legends. You know, when you click "q" and "left-click" the zone you want to attack. But, in my game, you can attack from everywhere. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:41 PM |
| Uh dood you don't gotta hold in q on league you just gotta press q then click where you want it Lol so basically just make an enabled thing if q is pressed then enabled = true or somethin :3 |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:44 PM |
| I already made the part where it says to press "q". But what about the MouseButton1down? o.o Is there a key that detects mouse click? |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:48 PM |
Oh my bejesus okay since you helped me i'll help you
stick a number value in the starergui then make that value 0
if the q gets pressed make the value 1
then for the ability if the value == 1 then do what ever
then you can make another script and once q gets pressed in the first script disabled it the enabled the second script then when the second script is enabled and you press q the 1 goes to 0 and the first script gets enabled again basically it deselects it
and the third script is the script that does the ability |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:50 PM |
| that might sound complicated but it's realllly simple. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:50 PM |
| oh dangit nvm that woulnd't work since we don't know how to do that mousebutton down thing v.v |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:52 PM |
| Wow... that's a lot of scripts for a simple ability o.o I have the "w", "e" and "r" also... :L |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:55 PM |
| OHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH what if you do the ability with another local script when you press a certain key like z or something instead of the button! |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:56 PM |
keys = { left_button = false; q = false; }
function KeyDown(key) if key:lower() == 'q" then keys["q"] = true end end
function MouseDown(mouse) keys["left_button"] = true if keys["left_button"] and keys['q'] then --do something here bro end end
and make the boolean keys false when key up or mouse up u can do that urself
|
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:57 PM |
If you want the q button to be clicked second then I recommend you add the "if keys["left_button"] and keys['q'] then" in there instead. This isn't entirely what you need to do, but this is the basic idea. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 09:58 PM |
| SERIOUSLY left_button THAT WAS IT?!?!?! i'm testing that out right now. |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 10:00 PM |
| PSHHH that doesn't worrk!!! |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 10:04 PM |
script here not tested
http://codepad.org/Z0kMuQqh
|
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 10:06 PM |
| I put a print in the section where you told me to put the code and nothing happened.. :/ |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 10:08 PM |
| worked for me, let me try on server |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 10:09 PM |
Nvm.
OMG thank you so much Dueling and TheNext! It worked! :D |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 10:11 PM |
| Does it not work in testing or something? |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2014 10:13 PM |
| It works in server and in test solo. lol :D |
|
|
| Report Abuse |
|
|
| |
|