well thats a great way of letting them exploit your game lol.
Read and actually think it through.
object value wont replicate client → server. Only server → client
if the server value needs altering through the client. - Remote
if client is being exploited - it needs to be compared
Your literally saying it, but not fully understanding that it it requires a remote should the client pass on any values.
You could create an auto-replication object system on the server. I did it, and it works great. I can create objects on the server and attach them to players. They get automatically sent to the attached player, and updates to the table are replicated. Also have useful functions inserted into the object to allow easy communication between the existing client/server object. Also, make sure you have a GUID for each object on the client and server!
However the server might need information from the client.
Which brings it back to needing remotes to communicate.
what your describing is a one way communication system which means the client wouldnt be able to give information e.g clicking on a gui button to earn cash.
I think you’ve misunderstood me. The server is the one that sends the information to the client, not the other way around. If the client somehow manages to change a value in the object, the server will send the real value anyways. The most up to date object always exist on the server, it would be ridiculous to allow changes from the client.
I mean you do you, I really do not see how this is relevant. Why would I use OOP for something like this? I’ve already used this system for an animated combat system. The server contains methods to construct the weapon, setup stats, etc. and then it’s sent to the player. Then, certain functions, such as attack, block, etc are exposed to the client. The client has no power in this case. Server/Client related properties and methods are separated. If I needed to send data from the client to the server, I’d do what every other developer does, and implement sanity checks on the server.
My approach is to keep data in ModuleScripts, because it means I don’t have to search through directories to get the values I’m looking for (like going through folders to find the value object, to then return the value). This can be harder to manage if you don’t organise it properly - but then again, the same applies to value objects.
You don’t need to use OOP to store data or variables, you can just keep it all in tables or dictionaries. However, a benefit of using object values and updating them on the server is that they automatically replicate. If you want more control over this, then keeping variables in scripts or at least not visible to the client would be the way to go, because then you can fire a RemoteEvent whenever you want and update the value stored on the client.
To cover what has been talked about in this thread, the security is almost exactly the same. Whatever the client can see, they can edit - this means any local variables, any local objects (value objects included). While, yes, you can obfuscate and do all of these methods to make it harder to understand your code for exploiters, it isn’t foolproof and you’d do better to not rely on that. Having a good server-client validation system is the key for security.
Hope this helped. Would advise the other people in this thread to stop derailing it from the original intention of the post. At this point, what you’re talking about it barely helpful to OP and it’s best to be discussed in DMs. Let’s keep this on topic.