Why is client and server getting diffrent results for a table

i have a module with a table, when i tell the server side to print it it prints this:
image

but when the client prints it eveything is at 0:
image

can clients just not access module or something?

1 Like

The contents of ModuleScripts aren’t editable by any script during runtime. When a script uses require on the module, that script has its own “copy” of the module so if you require the script and then the client prints the module, the client and the server are looking at their own copies.

2 Likes

if i re-require the module each time i wanan check it on client side, would that work?

You still wouldn’t have the same data the server has. If you re-require the module each time, it could lead to performance issues and you’d just have a bunch of copies of the module.

If you’re wanting to send the data from the server to the client, use a RemoteEvent.

Hate to break it to you, but that’s not how Module Scripts work.

The first time it is required is when it runs the script. Every require after that returns the same instance from the first require. It’s why you can’t have two returns because it is only run once and has to return the same output.

Okay, I did recheck everything and you are correct. That’s my mistake. The module can be ‘edited’ but only in the same Lua environment e.g. server, client, command bar. And in the case of OP’s issue, they will still need to use a RemoteEvent as the data changed on the server will not replicate over to clients.