generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Left-click of the mouse + keydown

Previous Thread :: Next Thread 
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
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
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
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
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
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
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
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
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
23 Nov 2014 09:29 PM
Well, I searched through Roblox Wiki and nothing about it...
Report Abuse
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
23 Nov 2014 09:31 PM
Hmm in a tool would be possible.
Report Abuse
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
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
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
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
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
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
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
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
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
23 Nov 2014 09:50 PM
that might sound complicated but it's realllly simple.
Report Abuse
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
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
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
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
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
23 Nov 2014 09:58 PM
SERIOUSLY left_button THAT WAS IT?!?!?! i'm testing that out right now.
Report Abuse
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
23 Nov 2014 10:00 PM
PSHHH that doesn't worrk!!!
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
23 Nov 2014 10:04 PM
script here
not tested

http://codepad.org/Z0kMuQqh

Report Abuse
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
23 Nov 2014 10:08 PM
worked for me, let me try on server
Report Abuse
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
23 Nov 2014 10:09 PM
Nvm.

OMG thank you so much Dueling and TheNext! It worked! :D
Report Abuse
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
23 Nov 2014 10:11 PM
Does it not work in testing or something?
Report Abuse
PleasantKillerman is not online. PleasantKillerman
Joined: 01 Nov 2011
Total Posts: 668
23 Nov 2014 10:13 PM
It works in server and in test solo. lol :D
Report Abuse
TheNextEvolution is not online. TheNextEvolution
Joined: 08 Apr 2010
Total Posts: 1624
23 Nov 2014 11:09 PM
doesn't work for me?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image