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: KeyDown

Previous Thread :: Next Thread 
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:11 PM
Why isn't this working?

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Shop = player.PlayerGui.Shop.Main

mouse.KeyDown:connect(function(key)
if key == "m" then
Shop.Visible = true
end
end)

-- PastDays
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
24 Aug 2016 04:11 PM
it's your script telling you to use UserInputService.InputBegan

Formerly ToxicDominator - add 17,509 posts
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:13 PM
I don't know how to use that...

-- PastDays
Report Abuse
Mitko0o1 is not online. Mitko0o1
Joined: 30 Nov 2010
Total Posts: 5725
24 Aug 2016 04:13 PM
KeyDown and KeyUp are deprecated from a long time, check these wiki posts for help:

http://wiki.roblox.com/?title=API:Class/UserInputService
http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputBegan
http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputEnded
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:15 PM
I've been told they are depreciated and i dont have time to learn how to use this method i just need to quickly fix it...

-- PastDays
Report Abuse
WrightPhillips99 is not online. WrightPhillips99
Joined: 27 Jun 2015
Total Posts: 667
24 Aug 2016 04:15 PM
or just do mouseclick or button one down
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:17 PM
I dont need a mouse to trigger it... why are you telling me this... i clearly need the key "m" to trigger it.

-- PastDays
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
24 Aug 2016 04:17 PM
"or just do mouseclick or button one down"
stop posting

Formerly ToxicDominator - add 17,509 posts
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:19 PM
Is anyone able to help...?

-- PastDays
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
24 Aug 2016 04:20 PM
check the output

Formerly ToxicDominator - add 17,509 posts
Report Abuse
TrainingToTroll is not online. TrainingToTroll
Joined: 27 Oct 2012
Total Posts: 1757
24 Aug 2016 04:20 PM
That script works fine for me, what's in your output?
Report Abuse
Mitko0o1 is not online. Mitko0o1
Joined: 30 Nov 2010
Total Posts: 5725
24 Aug 2016 04:20 PM
Here is a flashlight script of mine:

https://www.roblox.com/Flashlight-script-item?id=262575710

Check the way I made it work for the button F, just change it for the button you want and delete the rest of the script that is for the flashlight.
Report Abuse
TrainingToTroll is not online. TrainingToTroll
Joined: 27 Oct 2012
Total Posts: 1757
24 Aug 2016 04:21 PM
what's in your output(2)
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:25 PM
Their is no output.

-- PastDays
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:25 PM
There*

-- PastDays
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:32 PM
Great...

-- PastDays
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:37 PM
OK i made this yet it still isn't working...

local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local chatting = false
local player = script.Parent.Parent
local Shop = player.PlayerGui.Shop.Main

plr.Chatted:connect(function(msg)
chatting = false
end)

uis.InputBegan:connect(function(input)
if input == Enum.KeyCode.Slash and game.StarterGui:GetCoreGuiEnabled("Chat") then
chatting = true
elseif input == Enum.KeyCode.Return then
chatting = false
end

if chatting == false then
if input == Enum.KeyCode.M then
Shop.Visible = true
print("Shop Is Visible")
end
end
end)

-- PastDays
Report Abuse
Mitko0o1 is not online. Mitko0o1
Joined: 30 Nov 2010
Total Posts: 5725
24 Aug 2016 04:43 PM
Well try doing this at the second if statement:

if input == Enum.KeyCode.M and not chatting then
Shop.Visible = true
print("Shop Is Visible")
end

If that doesn't work try adding prints everywhere to see where exactly does the code stop working.
Report Abuse
Mitko0o1 is not online. Mitko0o1
Joined: 30 Nov 2010
Total Posts: 5725
24 Aug 2016 04:45 PM
Oh wait, it should be input.KeyCode = Enum.KeyCode.Slash instead of input = Enum.KeyCode.Slash

And fix it everywhere you search for a button press.
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
24 Aug 2016 04:47 PM
"Oh wait, it should be input.KeyCode = Enum.KeyCode.Slash instead of input = Enum.KeyCode.Slash"
you can't write to the key that was pressed lol

Formerly ToxicDominator - add 17,509 posts
Report Abuse
Mitko0o1 is not online. Mitko0o1
Joined: 30 Nov 2010
Total Posts: 5725
24 Aug 2016 04:49 PM
@Skel

UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(input, istyping)
if input.KeyCode == Enum.KeyCode.F and istyping == false then
if Enabled == false then
Enabled = true

This is part of my flashlight script and it works perfectly.
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:50 PM
Given up...

-- PastDays
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
24 Aug 2016 04:50 PM
instead of using the equal to operator you were trying to assign it a value

Formerly ToxicDominator - add 17,509 posts
Report Abuse
Mitko0o1 is not online. Mitko0o1
Joined: 30 Nov 2010
Total Posts: 5725
24 Aug 2016 04:51 PM
Oh, well sometimes this happens.

Its 1am at me, gonna go to sleep soon
Report Abuse
PastDays is not online. PastDays
Joined: 09 Jan 2011
Total Posts: 732
24 Aug 2016 04:53 PM
You could just fix it as all that you are doing is making me play musical words switching and replacing words then being told OOPS i mean do this...

Thank you for trying to help but i'm getting frustrated...

-- PastDays
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