|
| 31 Aug 2014 10:12 PM |
Hey guys! I'm making a paintball map and I want to make Ctrl or Shift a sprint key. Here's the beginning of the LocalScript inside the tool: local tool = script.Parent tool.Equipped:connect(function(mouse) mouse.KeyDown:connect(function(key) if key == "Ctrl" then print"The key works now!" end end) end)
I know the rest of the script is fine because I tried it with "h" and "g" and "z", but how would I make it control? Any help is needed. Thanks so much! |
|
|
| Report Abuse |
|
|
Subete
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 917 |
|
|
| 31 Aug 2014 10:16 PM |
relatively sure you need some number for ctrl
there is a function in the roblox wiki that tells you the info about a key you press, just put tht print function in something nd start pressing keys to figure out what you need for them |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Aug 2014 10:26 PM |
Found the page! You were right! Here's the new script!
local tool = script.Parent tool.Equipped:connect(function(mouse) mouse.KeyDown:connect(function(key) if key == string.char(50) then print"am work k" end end) end)
You were a big help! If you need the script its the roblox wiki and search "Taking Keyboard Input"! |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 31 Aug 2014 10:32 PM |
in a local script wait(1) Mouse = game.Players.LocalPlayer:GetMouse() Mouse.KeyDown:connect(function(key) if key == string.char(50) then print"am work k" end end)
You don't need to use a tool to get the mouse and you don't necessarily need to use a number (string.char) to reference to the key but you probably should, since it can get a little weird for keys aren't letters. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2014 11:39 PM |
| Yeah I know but this actually works now! Like I'm making the rest of the script and it works, plus I have the page I used in bookmarks so as long as it works for me! |
|
|
| Report Abuse |
|
|
Subete
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 917 |
|
|
| 31 Aug 2014 11:41 PM |
Glad I could be of assistance to you. :p
Although you did the hard part of it on your own I guess |
|
|
| Report Abuse |
|
|