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: (key=="Space") help

Previous Thread :: Next Thread 
SolidWhite is not online. SolidWhite
Joined: 29 Mar 2013
Total Posts: 1086
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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
22 Apr 2015 04:13 PM
key.KeyCode == Enum.KeyCode.Space
Report Abuse
mightybaseplate is not online. mightybaseplate
Joined: 28 Aug 2010
Total Posts: 7660
22 Apr 2015 04:13 PM
key==" "
I think space is literally a space
Report Abuse
SolidWhite is not online. SolidWhite
Joined: 29 Mar 2013
Total Posts: 1086
22 Apr 2015 04:13 PM
Oh, ok and why doesn't (key=="Space") work?
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
22 Apr 2015 04:14 PM
key can't match a string.

if key.KeyCode.Name == "Space" then
Report Abuse
SolidWhite is not online. SolidWhite
Joined: 29 Mar 2013
Total Posts: 1086
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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
22 Apr 2015 04:28 PM
Just noticed.. You missed a "." after ("UserInputService")
Report Abuse
SolidWhite is not online. SolidWhite
Joined: 29 Mar 2013
Total Posts: 1086
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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
22 Apr 2015 04:43 PM
Positions and Rotations take Vector3 values
.Position = Vector3.new(x, y, z)
Report Abuse
SolidWhite is not online. SolidWhite
Joined: 29 Mar 2013
Total Posts: 1086
22 Apr 2015 04:51 PM
Thank you so much Epicbreaker, I've advanced into more lua. :)
Report Abuse
Froast is not online. 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
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