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: why does this do this?

Previous Thread :: Next Thread 
dave2011 is not online. dave2011
Joined: 02 Oct 2010
Total Posts: 10581
15 Sep 2012 10:27 PM
local mouse=game.Players.LocalPlayer:GetMouse()
local Frame = script.Parent
local function onKeyDown(m)
--stuffs
mouse.KeyDown:connect(onKeyDown)

it lets you press any key for the "stuff" to work and I want it so it only does "stuff" if you press the m key
Report Abuse
mazer246 is not online. mazer246
Joined: 13 Sep 2007
Total Posts: 412
15 Sep 2012 10:32 PM
I believe you are missing an arg in your connect line.

local mouse=game.Players.LocalPlayer:GetMouse()
local Frame = script.Parent
local function onKeyDown(m) --you are calling upon a parameter here (m)
--stuffs
mouse.KeyDown:connect(onKeyDown) --however here you do not request the parameter
Report Abuse
mazer246 is not online. mazer246
Joined: 13 Sep 2007
Total Posts: 412
15 Sep 2012 10:35 PM
I am very rusty at RBX.lua but try this:


local mouse=game.Players.LocalPlayer:GetMouse()
local Frame = script.Parent
local function onKeyDown(key)
if key == "m" then --you need to check if the key is m, however, I am not sure how to do this
--stuffs
mouse.KeyDown:connect(onKeyDown(key))
Report Abuse
mazer246 is not online. mazer246
Joined: 13 Sep 2007
Total Posts: 412
15 Sep 2012 10:37 PM
blah, triple post D:

You can check what to put into the 4th line by printing key
Report Abuse
adark is not online. adark
Joined: 13 Jan 2008
Total Posts: 6412
15 Sep 2012 10:40 PM
local mouse = game.Players.LocalPlayer:GetMouse()
local Frame = script.Parent

mouse.KeyDown:connect(function(key)
if key == "m" then
--stuff
end
end)
Report Abuse
TheLuaTester is not online. TheLuaTester
Joined: 24 May 2012
Total Posts: 168
15 Sep 2012 10:42 PM
adark is right^

Plus put in local script.

if CookieMonster.pro == true
then do
repeat wait()
KirbyDance
until CookieMonster.pro = false --In other words, KirbyDance forever!

-Tester-
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
15 Sep 2012 11:11 PM
OT QUESTION:

Would this work not in a tool?
Report Abuse
dave2011 is not online. dave2011
Joined: 02 Oct 2010
Total Posts: 10581
15 Sep 2012 11:54 PM
@thedeath, I have tons of mouse things that would require a lot of different tools for my game so it would be much easier without tools
Report Abuse
SadPandaDog is not online. SadPandaDog
Joined: 09 Jun 2012
Total Posts: 172
16 Sep 2012 12:19 AM
@Death
Yea because of the new method >:o
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