I wanted to implement a simple health and stamina stuff. It sounds like data that you don’t want the player to play with, and like a lot of people on internet you may say data on the server then fire event when the value changed, is the way to go.
The truth is that I want health and stamina passive and active regen. So it would make a lot of events. I will even probably need to send the whole server stats to each player.
That’s why I’m wondering, wouldn’t the best thing be to let the “client handle it”. Of course the server will also compute the values, and it will send just one event with everything every… seconds ? Maybe a few seconds ? It won’t affect death events or stamina locked skills, because the server will be up to date.
Almost always the server.
How many players would a server have that you are worried about performance issues due to the events?
You can hold a reference to all players and their stats in the server, modify what’s needed and then simply broadcast it to all clients IF it is really necessary (which I doubt).
If you were to “let the client handle it” and let the server compute the value every second it would feel super laggy and wouldn’t solve your problem at all.
Roblox puts a server script in each character for things like health regen. If you want to do stamina regen simply use the same script and increase/decrease the stamina when you want.
I’m stupid… yes a script server works, but it doesn’t solve the problem to get the value to the client !
Let’s forget about humanoid and health special case (which still need to use the network, but is efficient). If I have a stamina Gui I want to update on the client side, it won’t work right ?
Are you sure about it ? Just tried and the server can’t find the value. The Client can though.
I would to have a replicated storage behaviour by player though.
I guess that if you have the time to drop a project copy with a simple exemple it would be really helpful.
Okay, it works fine, thanks ^^. The client can overide the value but it won’t change for the server, and if the client just read the serve can communicate simply.
During my research I found that UnreliableRemoteEvent is best “for replicating continuously changing data”. I’m wondering if it’s a size issue, like it’s faster to use the event if there is enough big data (probably with a buffer).
Of course I told you just about Health and Stamina, but if I have more and more data. Would the event be faster and consume less ?