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: Check if shift is being pressed?

Previous Thread :: Next Thread 
Keltrin is not online. Keltrin
Joined: 01 Jan 2014
Total Posts: 2085
28 Jun 2015 02:57 PM
^?
Report Abuse
Keltrin is not online. Keltrin
Joined: 01 Jan 2014
Total Posts: 2085
28 Jun 2015 03:03 PM
NO ONE knows how to check if the shift key is being pressed?
Report Abuse
baheeg is not online. baheeg
Joined: 19 Jul 2010
Total Posts: 72846
28 Jun 2015 03:04 PM
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

mouse.KeyDown:connect(function(button)
if string.byte(button) == 14 or string.byte(button) == 15 then
print("Shift clicked")
end
end)

must be a local script


-Baheeg
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
28 Jun 2015 03:07 PM
Thanks! I actually needed this, ill be sure to give credit :)
Report Abuse
baheeg is not online. baheeg
Joined: 19 Jul 2010
Total Posts: 72846
28 Jun 2015 03:07 PM
yw


-Baheeg
Report Abuse
Keltrin is not online. Keltrin
Joined: 01 Jan 2014
Total Posts: 2085
28 Jun 2015 03:07 PM
That didn't work, no output and nothing printed.
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
28 Jun 2015 03:11 PM
Cant Confirm if it works, havent tested..
Report Abuse
lateregistration is not online. lateregistration
Joined: 02 Apr 2013
Total Posts: 2630
28 Jun 2015 03:15 PM
local UserInputService = game:GetService("UserInputService")

local shiftDown = false

UserInputService.InputBegan:connect(
function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftShift then
shiftDown = true
end
end
end
)

UserInputService.InputEnded:connect(
function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftShift then
shiftDown = false
end
end
end
)
Report Abuse
baheeg is not online. baheeg
Joined: 19 Jul 2010
Total Posts: 72846
28 Jun 2015 03:21 PM
it doesnt work for some reason


-Baheeg
Report Abuse
UnConcerning is not online. UnConcerning
Joined: 30 Aug 2012
Total Posts: 676
28 Jun 2015 03:21 PM
i love how you post and within 6 minutes you are guessing nobody knows...
pls
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
28 Jun 2015 03:22 PM
game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftShift)
Report Abuse
IRyan70 is not online. IRyan70
Joined: 08 Jun 2011
Total Posts: 484
28 Jun 2015 03:27 PM
Epicbreakers's seems alot easier...doesnt it work the same as the one above?
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
28 Jun 2015 03:36 PM
Yes.
Report Abuse
lateregistration is not online. lateregistration
Joined: 02 Apr 2013
Total Posts: 2630
28 Jun 2015 03:42 PM
haha I had no idea that you could simplify it to that :P
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
28 Jun 2015 03:50 PM
You can also do UserInputService::GetKeysPressed() to get an array of all keys pressed.
Report Abuse
lateregistration is not online. lateregistration
Joined: 02 Apr 2013
Total Posts: 2630
28 Jun 2015 03:54 PM
wow userinputservice is probably my favorite service now
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