Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get mouse in server script service?

Asked by 6 years ago

Error code :

SeverScriptService.MainServerScriptService:120: attempt to index local 'mou' ( a nil value )

Code :

game.ReplicatedStorage.Events.RE.OnServerEvent:connect(function(plr)
local mou = plr:GetMouse()
print(mou.Hit.p)
end)

I was just testing some scripts but then errors popped up, im confused, can someone help?

0
You... just can't. Mouse is only gotten from the LocalPlayer Rare_tendo 3000 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You can't get Mouse from a server sided Script you would have to get it from a Local Script and use RemoteEvents / RemoteFunctions to send the mouse data you need to the server.

https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

Ad

Answer this question