Firing a Remote Event rapidly?

Why do you need to fire the client to do that? You should be able to get the players in the area and update it all on the server (unless the textlabel is in a screengui and not a bilboard ui)

That’s the problem here - it’s a PlayerGui I’m trying to access through a Server Script every x seconds. And by the Area I meant a Table.

Instead of firing every half a second, why don’t you just fire the client whenever a new player joins? Also, you can use FireAllClients() instead of FireClient if you want to update every client.

3 Likes

you can do this right in the localscript since the same information is readily available to the client as well

3 Likes

Firing a remote two times a second will not exhaust the queue if both sides are connected to the event.

There are perfectly fine use cases for firing a remote a few times per second, such as informing the server about character state.

3 Likes

Doesn’t quite answer my question since the Table is updated whenever someone does a certain action. So as soon as the table updates I want the server script to update the players’ textlabel showing how many people are in this table. I did try to fire the event when this table is updated(When something has been inserted or removed), however it might get pretty messy since I’ll have to deal with metamethods and etc.

Hold on. What exactly is your use case? What are you doing that supposedly needs a remote to go off this quickly? I’m sure there’s a better way to do this.

I’m sure there is another way, but I’m really confused at the moment. I think I’ve mentioned what I need above. What I want to do is for the ServerScript to sort of inform the players about how many of them are under a certain Tag.

I assumed he was referring to firing the server in the original post. If your game has a lot of players and you rapidly fire the server, that won’t cause remote event exhaustion and/or a lot of server traffic?

1 Like

I’ve used remotes before where I fire the server 2-5x per second to inform the server about character state (such as look angle) and this will never be the main source of bad server performance, nor event queue exhaustion.

3 Likes

I don’t get it. Please be explicit. What are you trying to do? What is all this about “tags” and whatnot?

There’s a ServerScript which has to inform the players through their GUIs about how many of them have the BoolValue - Tag, in total set as True.

People on Roblox often think using the network routinely to be a bad thing. This simply isn’t the case. It’s completely valid to fire a remote over quite a few times a second. The bandwith cost is mostly going to be in the content you’re sending over, so that’s the bottleneck to look out for. There’s no issue with sending traffic over the network upon every network tick when it’s called for.

16 Likes

No need for metatables, simply add an API to set whatever value it is you are concerned with, and have that function inform all clients that this happened.

local function set_special_value(new_value)
     -- set value
     -- inform clients
end

Oh thank you for the answer! Regarding what I said about the metatables, I meant that I attempted to track whether an object/value has been inserted in the table or removed, something like a .Changed event which fires a function but for the tables. Besides that, this is the answer that I’ve been looking for.

…? I still don’t understand. What is your use case? Are you checking for players alive or something? What is the server informing clients of? Where is the bool located? What is the tag? Are clients supposed to see how many “tags” are true out of everyone in the server?

I would most definitely not suggest this. You need to send the direction and position of the fire for every shot. This data needs to be absolutely accurate. You cannot achieve this with that method.

You can send a message every 0.5 seconds. You will not hit queue exhaustion nor experience latency due to this.

7 Likes

I’m checking if the players have a bool value set to true. The server is informing the players to display the amount of players in total who have this bool value set to true and this bool is located in the Characters of the clients. The tag is a bool value. If what I’ve said is still unclear to you, I’ll give you a visual representation of what I’m trying to do.

Okay, you should probably be fine then. There isn’t that much data involved, it so seems and firing a remote rapidly generally should not cause you trouble unless you exceed that 60 KB/s limit.

I was just wondering if there was a way to accomplish this in a different manner.

1 Like

How does that work? Won’t the bullets only be firing in one direction because you aren’t sending the mouse position anymore since you’re firing the event only when you click? What about when you click and drag? There are some problems with that solution