Problem: I need a boolean value to be accessible across all clients.
Method 1: Insert a ‘BoolValue’ into workspace.
Method 2: Use a RemoteFunction to ask a server script what the value of a boolean is.
Both of these methods allow all clients to access the value, although there may be pros and cons to each. What I’m trying to figure out is which method would be more efficient for the server. I’m aware that method 1 is probably not safe at all from exploiters, although I’m not sure that method 2 is safe either. If you know which would be safer, please let me know, but the my main question is still which method would be more efficient, quicker, use less data… thanks
cant i just use a remote event to set the bool value, then store it on the server, then when a client needs to access it it uses a remote function and the function returns the value?
also i have to have a value for each model in a folder with a lot of models… so would it take up a lot of space to make a table with the actual model as the key and the bool value and the value?
Does anyone know how to check how much data a table is taking up? is that a thing?
If the BoolValue (the instance and not the type) is created by the server in a location visible to clients (i.e. not ServerStorage/ServerScriptService), changes made by a client will only be visible on that client – you don’t need to worry about security.
If you’re hiding it from modification even from just the one client for security reasons, they can mess with your RemoteFunction too so that the client thinks it returned a different value than it did. The client has full control over any code it executes, so you should give up any clientside security if this is the case.
Wait so if you make a boolvalue in workspace, and change it on the client, it will only change for that client? Is that what you were saying? because that doesn’t sound right to me… ill have to test it
Yep. That’s the point of FilteringEnabled – changes made by the client don’t replicate to the server or other clients, so you don’t have to worry about people messing with your game. If you change anything on the server though, it replicates to all clients as normal.
Yep. Clients have access to everything on their local machine – no way around it. You can obfuscate your code so that if someone tries to use it, the variable names are rubbish, but that won’t do much good. Your best bet is just making sure anything security-related is done on the server so it doesn’t matter if they know how the client works.
would an instance in workspace be the same on the server and clients or would it be a duplicate on the client? For example… would workspace.Part (in a server script) == workspace.Part (in a local script)?
You should set up your remote events in a way that they can be verified. For instance, instead of having a RemoteEvent “GiveMoney(amount)”, you’d have “RequestSellItem(item)”. The server would be able to verify that you had the item in your inventory and determine whether the request is legitimate or not.
Yes, all instances created by the server (which includes anything present on startup) are synced to the client. You can break this sync by deleting the object locally and then creating a new, duplicate, but otherwise they’re the same.