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: whats wrong with my script

Previous Thread :: Next Thread 
guagiguagua is not online. guagiguagua
Joined: 15 Dec 2016
Total Posts: 206
04 Nov 2017 03:26 AM
For some reasons, this should work, but the error says 'attempt to index LOCAL mouse a nil value'
all i do is, i go to game.Players, then i find the mouse using the string of the name of the folder it is descended from, but it doesnt work. I looked through the wiki but it doesnt say anything about 'not compatible with normal scripts', i thought hit was the problem but obviously not because it worked inside studios but now i dont know what to do
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
04 Nov 2017 03:29 AM
someone's mouse is only accessible client side

thus, not accessible through a normal script, only a local script
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
04 Nov 2017 03:30 AM
You should go look up what those terms mean, because you're not using them appropriately
You CAN NOT get the mouse with normal scripts- nor should you be trying to. They must be local, as the mouse is a local object.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local char = player.Character or player.CharacterAdded:wait()
mouse.TargetFilter = char -- don't wanna be clickin on your own char

mouse.Button1Down:connect(function()
local targ = mouse.Target
if targ then
print(targ.Name) -- the name of the part you clicked
end
print(mouse.Hit.p) -- the position of where your mouse clicked
end
end)
Report Abuse
guagiguagua is not online. guagiguagua
Joined: 15 Dec 2016
Total Posts: 206
04 Nov 2017 03:32 AM
I cant use a local script, im controlling a sphere thats part of another folder and can definetly not be in my character, my player, or whatever
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
04 Nov 2017 03:35 AM
That's too bad, cuz you have to use a local script.

Also, just think logically...
Why would the SERVER be able to get your mouse data? It's a separate machine altogether!
If you want to give it the data to work with you need to send it through a RemoteEvent from client to server.
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
04 Nov 2017 03:35 AM
regardless of what you use to control this other object, you must use a local script if you are trying to access a player's mouse
Report Abuse
guagiguagua is not online. guagiguagua
Joined: 15 Dec 2016
Total Posts: 206
04 Nov 2017 03:40 AM
i only have a local script for the camera, so... i put my 'control sphere' script inside the local script and it might work
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
04 Nov 2017 07:14 AM
No lol
It won't.
You need to understand the separation between client and server.

The client is the game running on your computer how you see it, including everything processed through your peripherals.
What you are actually looking at is the game in the past.

Your ping is a measure of your latency from client to server- that is, the amount of time it takes for some event on the server to be seen by your client and vice versa. This is compensated for by predicting where things will be in regard to where they last were on the server, such as character movement and part physics.

All clients get their info about the game from the server.

The server is on Roblox's side, where the game itself is processed and handled.
It has no connection to the client in terms of peripherals (i,e, your mouse), local settings, how you render the game, etc. It only understands from you what you send to it (aside from things like character position that are automatically sent), which is why you must manually send your mouse info, and every other input info for that matter.
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