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: Mouse is a nil value?

Previous Thread :: Next Thread 
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
21 Feb 2015 07:19 AM
I made this to connect my function and it says it's a nil value.

mouse.KeyDown:connect(FireWall)

Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
21 Feb 2015 07:29 AM
Did you define the mouse?
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
21 Feb 2015 07:37 AM
update notes:
Added deprecated tag to Event Mouse.KeyDown
Added deprecated tag to Event Mouse.KeyUp
move to UIS



AND THE TIGER GOES ROAR
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
21 Feb 2015 07:40 AM
"Did you define the mouse?"

I didn't know I had to. How do I do it?
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
21 Feb 2015 07:41 AM
before you ask
UIS is userinputservice
wiki it to win it



AND THE TIGER GOES ROAR
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
21 Feb 2015 07:41 AM
(sorry for double post)
in local scripts you can just do
local mouse = game.Players.LocalPlayer:GetMouse()



AND THE TIGER GOES ROAR
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
21 Feb 2015 08:10 AM
http://wiki.roblox.com/index.php?title=Mouse

Define Mouse:

Inside LocalScript

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()

function FireWall()

end

Mouse.KeyDown:connect(FireWall)

"I like to program." - Bosswalrus
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
21 Feb 2015 08:24 AM
Why can't you put it in a server script?
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
21 Feb 2015 09:09 AM
Because this line

Player = game.Players.LocalPlayer

Would return nil.

"I like to program." - Bosswalrus
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
21 Feb 2015 05:39 PM
"Player = game.Players.LocalPlayer"

Cant I just use script.Parent.Parent:GetPlayerFromCharacter().Parent ?
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
21 Feb 2015 05:45 PM
Im using this in play solo:

mouse = script.Parent.Parent.Parent:GetMouse()
--code
mouse.KeyDown:connect(functionname)

And it doesn't work. It doesn't give an output either. I prefer not to use local scripts because I don't know what I have to change when I use them.
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
21 Feb 2015 06:09 PM
Bump
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
21 Feb 2015 07:53 PM
:GetMouse() can only be obtained in a localscript




AND THE TIGER GOES ROAR
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
22 Feb 2015 08:01 AM
Is there a way to do it without using a local script? I really have no idea how to use them.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Feb 2015 08:04 AM
you couldn't really get a local player's mouse with a server script..
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Feb 2015 08:05 AM
if it helps you understand local scripts slightly better, they only run inside of the player, or if they are ran inside of the character. (descendants of players only i think)
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
22 Feb 2015 08:44 AM
Theres no other way to tell if someone presses a button besides a local script? And I was wondering what I would need to change in my code in a local script compared to a regular script.
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
22 Feb 2015 12:36 PM
Bump.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
22 Feb 2015 12:38 PM
Use a RemoteEvent for this sort of stuff.
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
22 Feb 2015 12:40 PM
What is a remote event and how do I use it?
Report Abuse
TheSupremePatriot is not online. TheSupremePatriot
Joined: 14 Apr 2012
Total Posts: 5453
22 Feb 2015 12:41 PM
Mouse.ButtonDown1

Wouldn’t that be what you need to use?
Report Abuse
yoshiegg6 is not online. yoshiegg6
Joined: 20 Jul 2012
Total Posts: 3191
22 Feb 2015 12:44 PM
That's for clicking and its mousebutton1down.clicked. This is for when someone Presses a button.
Report Abuse
TheSupremePatriot is not online. TheSupremePatriot
Joined: 14 Apr 2012
Total Posts: 5453
22 Feb 2015 12:45 PM
Click Detector maybe?
Report Abuse
bojigglesmister2 is not online. bojigglesmister2
Joined: 26 Jun 2011
Total Posts: 1421
22 Feb 2015 12:46 PM
mousebutton1down.clicked? no



its MouseButton1Down

MouseButton1Up

MouseButton1Click
Report Abuse
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
22 Feb 2015 12:52 PM
It's impossible to access the player's mouse from a server script.
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