If I have something stored in _G. Can it be changed by the client?
For example can _G.SomeNumber = 10
be changed from 10 to 100 on a localscript, and will the server see this change as well?
If I have something stored in _G. Can it be changed by the client?
For example can _G.SomeNumber = 10
be changed from 10 to 100 on a localscript, and will the server see this change as well?
No, changes on the client do not replicate to the server. (Unless it’s changes to the character, iirc.)
It’s similar to ReplicatedStorage, Workspace, Lighting, etc.
The client and server can both access the contents of all of those, but if the client wants to make any changes to those things on the server, they would need to send a message via a RemoteEvent/Function and have the server change it itself.
The table generated on the server under _G
is a separate, different table than the clients generate under _G
. Each machine (that is to say, clients and servers) have an isolated _G
.
I see. So there is a separate _G
table for each different machine? Or the clients share their _G
table with each other, and the server has its own?
Yes, every machine[1] has a separate copy of the entire environment too, not just _G
.
[1] Roblox servers are hosted in groups on the same physical machine, but what I mean here is the instance of the running server.
Changes to the character don’t replicate. The only thing that does is character physics and animations, which are primarily due to the systems that allow those to happen. For physics it’s network ownership where the owner entity is authoritative of that part’s physics and for animations its the Animator object.