What would be the better way to update players' GUI through the game loop?

Idea 1:
Create a StringValue in ReplicatedStorage and update it in the game loop, then call :GetPropertyChangedSignal() in a LocalScript within the player’s Ui to update the Ui.

Idea 2:
Create a RemoteEvent and pass through the string that should be displayed on players’ screens.

I am wondering what the “better” way to do this is of the two ideas I have, or possibly other ideas.

It’s good that you are using events, always better than wait() loops. Your second idea might be better, however people joining will need to send a request over said RemoteEvent to receive a value. This would not be the case if you had a StringValue in ReplicatedStorage.

1 Like

when the player join, pressing Start will load all Data

sending information to the Client showing that the Data is done, and updating all
in a local script [OnClientEvent] – all Data loads on all texts,

-now how data will be updated again? the server will need to sync and send more info, because the player is collecting items, cash and exp at the same time,

-Server side
when the player receive money or some item, the server will save internally, detecting any value that changes on the player’s Data

( for example, if you are using IntValues or values stored on the Player or somewhere )

when that value changes, on the client side it will update any value at the same time

so what we have here:

–When any value changes [Server side] it will save stuff Internally ( you can’t see)

–when any value changes [Client Side] it will show [Visual]

i never send alot of remote events to alert some local script saying that they should update the TEXT, or some value on it, except if i need some sort of communication between the server and the client and must update values constantly…

Ex:
when i upgrade some armor, i will use values stored on a module [Client Sided]
having all stuff-

–ONLY IF THE SERVER accepts the upgrade, preventing exploits–
if the server accepts then it will show visually to the client their new upgrades.
[the server will not send new stuff to the client, he will update internally]
-because i already have the module that detects any changes Client-Sided

what about hackers:
the client can do anything visually, but their stats are different. [Only the server matters, as long you have barriers and sanity checks, the server is safe]

there is alot of stuff to talk about… i’ll end here

1 Like