i keep getting a error when i try to get the mouse
local player = game.Players.LocalPlayer
local mouse = player:GetMouse() -- the error is here
the error message is : 17:45:02.409 - Workspace.Script:2: attempt to index nil with 'GetMouse'
i keep getting a error when i try to get the mouse
local player = game.Players.LocalPlayer
local mouse = player:GetMouse() -- the error is here
the error message is : 17:45:02.409 - Workspace.Script:2: attempt to index nil with 'GetMouse'
You can't find LocalPlayer in a normal script, thus you can't get :GetMouse(). You can only do it on local scripts. You should also know that local scripts can't run in workspace.
This discussion is preserved as it was. New answers, comments, and votes are closed.
8 comments
so what would i use to get the player because i cant have it in a local scriptt
You can send the mouse variable to a server script using a remote event.
and how would i do that
https://developer.roblox.com/en-us/api-reference/class/RemoteEvent this page has info on remote event's, you can also watch a tutorial on it, but basically what you want to do is send the "mouse" variable in the localscript in the argument in :FireServer()
i know what they are but im trying to make the roblox arm face the mouse
but in what u said i understood but the argument bit
In .OnServerEvent you can get the mouse variable and do your script normally. About the arm facing the mouse, I can only tell you to use CFrames. After you made a script and if it doesn't work, you can make a question and we'll fix it for you.
okay