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 » Scripting Helpers
Home Search
 

Re: Button1Down and KeyDown connected

Previous Thread :: Next Thread 
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
04 Nov 2011 05:30 PM
Is there a way while holding the left mouse, and then press a button?

Here's my sample

Tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
--Script
mouse.KeyDown:connect(function(key)
key=string.lower(key)
if key=="q" then
--Script
end
end)
end)
end)
Report Abuse
aboy5643a is not online. aboy5643a
Joined: 20 Nov 2010
Total Posts: 2785
04 Nov 2011 05:33 PM
local clicked;
Tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
clicked = true
end)
mouse.Button1Up:connect(function()
clicked = false
end)
mouse.KeyDown:connect(function(key)
if clicked then
if key == "q" then
--Script
end
end
end)
end)

That'll do what you want.
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
04 Nov 2011 06:14 PM
I meant like while you are holding the Button, and press a key.
Report Abuse
GigsD4X is not online. GigsD4X
Joined: 06 Jun 2008
Total Posts: 3794
04 Nov 2011 06:31 PM
^ That's what aboy wrote. When the user clicks, it sets a variable to true and when he lets go it turns false—when a user presses a key it checks if the variable is true and executes the code if it is.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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