|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|