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: Weird Uppercase keydown script?

Previous Thread :: Next Thread 
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
14 May 2015 02:23 PM
Hi guys!

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
gui = script.Parent.Menu.Frame
Open = false
Mouse.KeyDown:connect(function(key)
if key:lower() == "m" then
gui.Visible = not gui.Visible
end
end)

I have this script - it works if I press Shift and m making it an uppercase, but it doesn't work just pressing normally :/
Any ideas?
Thanks
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
14 May 2015 02:29 PM
local UIS = game:GetService("UserInputService")
local gui = script.Parent.Menu.Frae
local Open = false

UIS.InputBegan:connect(function(input)
if input.KeyCode == 109 then
gui.Visible = not gui.Visible
end
end)
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
14 May 2015 02:37 PM
Thanks! but it doesn't work :(
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
14 May 2015 02:38 PM
do you get an error?
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
14 May 2015 02:47 PM
Nope :(
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
14 May 2015 02:50 PM
then place some prints and check where it goes wrong :)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
14 May 2015 03:19 PM
I mispelled Frame, but just in case I still added the prints:


local UIS = game:GetService("UserInputService")
print("UIS exists: ", UIS.Name)
local gui = script.Parent.Menu.Frame
print("gui exists: ", gui.Name)
local Open = false
print("Open set: ", Open)

UIS.InputBegan:connect(function(input)
print("INPUT!")
if input.KeyCode == 109 then
print("M PRESSED")
gui.Visible = not gui.Visible
print("Visible: ", gui.Visible)
end
end)
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
16 May 2015 02:50 PM
Thanks!
It is so weird :(
It is registering "INPUT!" but not showing the gui :/
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
16 May 2015 03:09 PM
try to place

print(input.KeyCode)

after

print("INPUT!")

maybe that will give us some info.
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
16 May 2015 03:13 PM
local contextService = game:GetService("ContextService")
local frame = script.Parent:WaitForChild("Menu"):WaitForChild("Frame")


local function toggleGuiVisiblity(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
frame.Visible = not frame.Visible
end
end

contextService:BindAction("toggleGuiVisibility", toggleGuiVisiblity, false, Enum.KeyCode.M)
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
16 May 2015 03:19 PM
NOOOOOO

NOT THE contextService!!! D:

(I have a trauma with that service) xD
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
17 May 2015 02:32 PM
I still haven't fixed it :/ Very confused.

This works but only if you press Shift and M making it an uppercase?!

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
gui = script.Parent.Menu.Frame
Open = false
Mouse.KeyDown:connect(function(key)
if key:lower() == "m" then
gui.Visible = not gui.Visible
end
end)
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
17 May 2015 02:33 PM
Just use what I posted.
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
17 May 2015 02:36 PM
Doesn't work.
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
17 May 2015 02:38 PM
That means the frame doesn't exist.
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
21 May 2015 02:19 PM
It is.
For some weird reason, this works but only if I make it uppercase by pressing shift and M - Any ideas?! My caps lock is not on.
Thanks

local uis = game:GetService('UserInputService')

local gui = script.Parent.Menu.Frame


uis.InputBegan:connect(function(input)

if input.KeyCode == Enum.KeyCode.M then

gui.Visible = not gui.Visible
end
end)
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
21 May 2015 03:05 PM
Bump :(
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
21 May 2015 03:08 PM
http://wiki.roblox.com/index.php?title=Keyboard_input#math.noise

function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.M then
print("M was pressed")
end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
21 May 2015 03:10 PM
Thanks but it only prints "M was pressed" when I press Shift and M making it an uppercase? It is so weird :( Any ideas?
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
21 May 2015 03:36 PM
so. let me have this clear

Is your problem that the function is only called when you press shift+m and not if you only press m?

Or is your problem that you want to check if shift is pressed so you can see if it's 'm' or 'M'?
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
22 May 2015 02:23 AM
"Is your problem that the function is only called when you press shift+m and not if you only press m?"

^^^ this :(
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
22 May 2015 02:49 AM
Wierd. I used checked my code and it worked in both cases. I think ROBLOX doesn't understand your keyboard correctly. I'm not sure you could do anything about that. Maybe contact ROBLOX support for this issue???
Report Abuse
jjwood1600 is online. jjwood1600
Joined: 14 May 2013
Total Posts: 1633
22 May 2015 05:11 AM
Thats really weird and annoying?! Hmm. But in other games, I have pressed M to open the menu and it worked fine?! I am using the same script as them as well! :(
Report Abuse
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
22 May 2015 05:23 AM
Maybe it's a ROBLOX studio bug? Try to publish it and check if it works then (F10 to get the output in ROBLOX player)

Otherwise I'm clueless on what causes this, and how to fix this.
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