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: Key Down event not working?

Previous Thread :: Next Thread 
Cheeso135 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
07 Nov 2014 04:27 PM
local mouse = game.Players.LocalPlayer:getMouse()

mouse.KeyDown:connect(function(key)
if key == "e" and game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency == 0 then
game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency = 1
end
if key == "e" and game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency == 1 then
game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency = 0
end
end)
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 04:27 PM
GetMouse!

GetMouse!

And your if statements make me cry :'(
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 04:28 PM
Protip: If a method name begins with a lowercase character, its wrong.
Report Abuse
Cheeso135 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
07 Nov 2014 04:31 PM
local mouse = game.Players.LocalPlayer:getMouse()

mouse.KeyDown:connect(function(key)
if key == "e" and game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency == 0 then
game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency = 1

elseif key == "e" and game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency == 1 then
game.Players.LocalPlayer.PlayerGui.ScreenGui.ScrollingFrame.BackgroundTransparency = 0
end
end
end)

I changed it up to this...I think it will fi my problem and I am sorry it is so sloppy lol....the ends are screwed up somehow?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
07 Nov 2014 04:32 PM
Protip: If a method name begins with a lowercase character, its wrong.
^thats wrong
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 04:32 PM
You put getMouse, it should be GetMouse.

Also, you should consider variables.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 04:33 PM
@128GB: Examples, please. And nothing deprecated, that does not count (because they are deprecated)
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
07 Nov 2014 04:34 PM
local mouse = game.Players.LocalPlayer:getMouse()

there you go
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 04:37 PM
@128GB: Never use deprecated methods.

Or ClearAllChildren, as I learned the hard way.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
07 Nov 2014 04:38 PM
Where does it say getMouse deprecated
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
07 Nov 2014 04:51 PM
Roblox's naming scheme is all sorts of stupid. For example, properties in bodyPositions and bodyGyros are all lowercase (position and cframe) where their counterparts are capitalized in parts (Position and CFrame). Furthermore, certain older methods are camel case format, and the newer ones are all pascal case. This is a serious issue that is teaching bad practice, as the current industry standard is camel case.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 04:55 PM
@128GB: print(game.Players.LocalPlayer.getMouse)
(WARNING) >22:55:00.551 - "Player.getMouse" should be "GetMouse"
>function: 1D17C5F0
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
07 Nov 2014 05:03 PM
That doesn't make it depreciated
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 05:05 PM
Well, you should not be using it, it flags a warning.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
07 Nov 2014 05:06 PM
Does that actually do anything?
(Thats an actual question I'm not trying to be a smarta)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
07 Nov 2014 05:07 PM
It doesn't make it deprecated. It makes it wrong. Roblox is just giving you a gotcha, and aliasing the camelCase variant to the PascalCase method so that your script doesn't break.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
07 Nov 2014 05:08 PM
No, but its terrible practice. You should NEVER use something labeled as deprecated, as it may be removed in future, or simply become broken.
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