Need help for firing remote events without getting event exhaust calls

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.

  1. What do i want to achieve?
    Displays current score to players without using instance values.

  2. 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.

Use a module script ? (Instance values is good to but okay…)
30 character

I’m using module script. 30 characters

1 Like

Create a functionEvent and this return a module value to the localscript

It’ll throw error or not at 1/60 seconds rate? 30 characters.

The Problem with Your Current Implementation…

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 hope this helped!

The reason why I put it on server because the server will make changes to the it, I don’t trust clients.

1 Like

Is there a reason why you don’t use Values to let the client listen for the change while the server will handle the change?

yea i know, but if the only information that the function can return are timers it is not that bad
After, these are not the best solution

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.

I don’t want to use many instances values as possible on my game, I’m also converting my player data table to lua based.

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.

1 Like

I don’t trust clients. 30 characters

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.

1 Like

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.

and the only danger would be that a local script locally check the value to return it to the server (I think)

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.

I’ll try to fire the event at 1/25 seconds, 30 characters

I know, I just said the pros when using Instance Values. There are multiple ways to store the player’s without it listening to the Values.