Right now I have a remote event in replicated storage and I fire the specific client when I need the mouse.hit. The client then fires back to the server with the mouse.hit. Is this the best way to do it?
Just a heads-up: grabbing
mouse.hit info from a player’s side and sending it over to the server might not be the best idea, and here’s why:
Delay Issues: When you ping the server with a RemoteEvent, there’s bound to be some lag. So, there’s gonna be this tiny pause from when you ask for that
mouse.hitand when you get it.
Can We Trust It?: Some players might get cheeky and mess with the client-side. So if you’re banking on that
mouse.hitdata being legit, remember that there’s always a chance someone’s trying to pull a fast one on you.
Too Much Chatter: Asking for the
mouse.hitposition a lot? Like, all the time? That’s a heap of back-and-forth with the server. And that can slow things down, especially for those on shoddy Wi-Fi.
But hey, I get it. Sometimes, you really need to know where the player’s pointing or clicking. So what can you do?
Well, think about these:
- Keep It Local: Maybe decide things on the player’s side without always asking the server. Especially if it’s just for looks and doesn’t really affect gameplay.
Chill on the Requests: If you gotta know the
mouse.hitoften, maybe don’t ask every single frame. Take a breather, and ask every few frames or when things really change.
Double-Check: If that
mouse.hitis super important for the game, like scoring a hit in an FPS, take the client’s word with a grain of salt. Check it on the server to make sure it’s on the up-and-up.
Hope that helps!