Howdy!, Alright I made a system that shows the score of the player using remote events, I don’t like using instance values for this one to avoid get exploited.
What do i want to achieve?
Displays current score to players without using instance values.
What is the issue?
It sends the data by remote event from module script on server to clients every ~1/60 seconds, I’m aware to get error on log for firing this event on that rate.
It sends the data by remote event from module script on server to clients every ~1/60 seconds
Almost every networked game doesn’t send network updates at the same speed as the framerate. I think the most common networked game send rate is 20Hz (1/20th of a second). This is because each player can only receive and send so much data per second.
Imagine each player’s connection as a set of pipes that can send or receive water (data.) Every player’s pipe is only so big, so sending data every 1/60th of a second is going to clog the pipe. Roblox’s RemoteEvents have an internal message queue that ensures that you can’t ever clog the pipe completely, and this is what error you are seeing.
Instances are secure if kept out of places where the client has network authority.
Using instance values to show player scores is completely fine as long as you use FilteringEnabled (which should be standard in 2020 of all years) and keep the instance outside of a place where the client can change it.
In other words, if you have a folder in ReplicatedStorage with the player score value instances, you will be fine. While exploiters can change the value on their client, FilteringEnabled will prevent that change from being replicated to all other clients unless the server itself changes it.
Addendum: If you really want to keep score as raw lua memory
If you really want to keep score as a lua variable that you replicate via RemoteEvents, you should only send the client’s score to the client when the score changes. Unless you have a crazy scoring system, there is likely a long (1+ seconds) delay between points being added. By only broadcasting the scores when it changes, you send only a tiny amount of data over a longer period of time and in turn prevent your code from “clogging the data pipe.”
I’m really confused about this question.
Are you having the client tell the server their score, or the server tell the client their score?
If its the latter, then just use IntValues or a similar instance, as remote events aren’t more secure than intvalues (by nature, IntValues and other ValueInstances are more secure as the values don’t replicate, but remote events can be spoofed)
If its the first, then you definitely need to have the server track the players score instead.
The reason the remote event is being exhausted, is that your firing every 1/60 of a second. There is no reason to update the client that often. Maybe tell the client to update everytime their score changes instead.
It is much more safe to have Instance Values, you wouldn’t even need to use a remote event. Without a proper explanation of why you really need to, I can’t find a good answer. Storing Instance Values in the player is better than using a remote event to update.
You don’t need the client to change the value. They can’t, and they never will. If a value is changed on the client, it won’t replicate to the server. That’s why I said only let the server change the value while the client listens on the change.
If you are thinking because when you changed a value on the client while testing, it didn’t replicate to the server. It is their perspective, and there is no reason for you to be worried about that. As long as you have a secured remote event, it will be safe.
If he doesn’t want to use Value Instances, he doesn’t have to.
There is some legitimate use cases for not using Values, like storing data. If the player leaves (and the player instance is destroyed) before the server is able to save the data, the server can still save the data because the data won’t be destroyed.
@EthanBlox_TV
Send the remote event to the client each time their score updates instead of firing every frame. It is much more efficient than firing it every frame, and gives effect as listening to an Values .Changed event.