|
| 22 Apr 2015 04:12 PM |
It doesn't seem to work when I press Space. Anyone know why? This is in a Localscript in StarterGui. Thanks in Advanced
local arm = game.Workspace.Arm
game:GetService("UserInputService")InputBegan:connect(function(key,gui) if (key=="Space") then arm.Pan.Pan.Position = "-56.212, 18.208, -75.722" arm.Pan.Pan.Rotation = "-161.052, 0, 180" arm.RightArm.Position = "-52.213, 16.871, -79.379" arm.RightArm.Rotation = "90, -60, 90" arm.Pan.Handle.Position = "56.212, 16.989, -72.162" arm.Pan.Handle.Rotation = "-161.052, 0, 180" else arm.Pan.Pan.Position = "-56.212, 17.024, -75.789" arm.Pan.Pan.Rotation = "-176.052, 0, 180" arm.RightArm.Position = "-52.384, 17.7, -79.379" arm.RightArm.Rotation = "90, -75, 90" arm.Pan.Handle.Position = "-56.212, 16.765, -72.045" arm.Pan.Handle.Rotation = "-176.052, 0, 180" end
|
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:13 PM |
| key.KeyCode == Enum.KeyCode.Space |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:13 PM |
key==" " I think space is literally a space |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:13 PM |
| Oh, ok and why doesn't (key=="Space") work? |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:14 PM |
key can't match a string.
if key.KeyCode.Name == "Space" then |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:17 PM |
| Hmm, but when I use that instead of (key=="Space"), it doesn't work either. Any know why? |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:27 PM |
game:GetService("UserInputService").InputBegan:connect(function(key) if key.KeyCode.Name == "Space" then print(true) end end) |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:28 PM |
| Just noticed.. You missed a "." after ("UserInputService") |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:31 PM |
| Oh, Thanks. When I added the change position part of my script to yours, it still didn't work. ;.; Any other suggestions? |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:43 PM |
Positions and Rotations take Vector3 values .Position = Vector3.new(x, y, z) |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2015 04:51 PM |
| Thank you so much Epicbreaker, I've advanced into more lua. :) |
|
|
| Report Abuse |
|
|
Froast
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 3134 |
|
|
| 22 Apr 2015 05:11 PM |
| when comparing you have to use the enum as opposed to its string form (which you can use to set) |
|
|
| Report Abuse |
|
|