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: attempt to index local 'mouse' (a nil value)

Previous Thread :: Next Thread 
ScriptOnwards is not online. ScriptOnwards
Joined: 14 Dec 2016
Total Posts: 27
02 Sep 2017 08:36 PM
local mouse = player:GetMouse()
mouse.KeyDown:connect(function(key)
if key == "r" then
playAnimation()
end

the title is the error im getting, the error is occuring at the 2nd line.
also, this works in studio but not in the regular game.


Hippos eat walruses, walruses eat hippos. The circle of life.
Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
02 Sep 2017 08:37 PM
KeyDown is deprecated, use UserInputService.

http://wiki.roblox.com/index.php?title=API:Class/UserInputService


Report Abuse
ScriptOnwards is not online. ScriptOnwards
Joined: 14 Dec 2016
Total Posts: 27
02 Sep 2017 08:55 PM
Thanks.


Hippos eat walruses, walruses eat hippos. The circle of life.
Report Abuse
ScriptOnwards is not online. ScriptOnwards
Joined: 14 Dec 2016
Total Posts: 27
02 Sep 2017 09:01 PM
it didn't work.
game:GetService("UserInputService"):IsKeyDown(114)
playAnimation()
end)
i don't get any errors, so it might be the function. the function is local in a playeradded event, if that changes anything.


Hippos eat walruses, walruses eat hippos. The circle of life.
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
02 Sep 2017 09:02 PM
do you even wiki

game:GetService('UserInputService').InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end --if player is typing in a textbox
if input.KeyCode == Enum.KeyCode.R then
playAnimation()
end
end)


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