Basically what the title says, i need some way to detect if a player has moved his mouse and to where… mouse.target is not unfortunately what I need because it shows a general position and not the exact one in a server-sided script so…
Nope, I still wish they added one to make an easy gun system
local Mouse = playerHere:GetMouse()
Mouse.Move:Connect(function()
--your code here
end)
Get the mouse of the player using :GetMouse()
and Move
fires everytime the position of the mouse changed.
You don’t want to be handling input like this on the server. It will cause input lag depending on ping. What are you trying to do which requires this?
Mind explaining what’s an input lag is? (Sorry if off-topic)
If you click, or press a button, or move your mouse, you expect the game to respond instantly. Your brain works so fast that it can feel even a little bit of unexpected delay between button press and the game performing the action. It’s especially noticeable with movement and camera based input.
Ping is generally not less than 60 or so milliseconds, which is definitely noticeable. If you’re handling the input on the server, a ping of 60 means that your button press will take at least 30 milliseconds to reach the server. The signal is then processed, let’s say it’s to start moving your character. Your character moves a little as a result of the button press, and your character’s new position and speed are sent over the network (another 30 milliseconds) so you can see the result. This is bad and it can lead to negative experiences, and even more especially with timing-critical games like obbies or PvP games.
If you’re familiar with FilteringEnabled or how LocalScripts can’t make changes to the server without RemoteEvents, you’ll find that they actually can make changes to the Character and they don’t need RemiteEvents for that. This is to prevent input lag. The character should be handled by the client and any LocalScripts instead of by the server.
You can get input lag even if you’re not handling input on the server. If something is wrong with the code or your computer or hardware, it is totally possible to get an input delay even when the developer handles it properly. By way of anecdote, I was once using a cheap wireless PlayStation controller with some kind of lag issue. In this case it was subtle enough that I didn’t always feel the input lag, but whoever was using that controller became suddenly bad at timing-critical games like For Honor.
I need a particle to follow the players mouse, aerver-sided. This is the way I first thought of
That should be fine. Players will notice the lag though.
The mouse returns nil when I try it on the servers side,who I work for knows about this risk of lag already