I need a table of data for each player, that can be edited by the server, but read by the client. Is a module script the way to go on this? I haven’t used them much so I don’t know if this the simplest way to go about it
--Server Script
local SentTable = game.ReplicatedStorage.SentTable
Local ServerTable = {
[1] = "no"
[2] = "yes"
[3] = "i don't know"
}
SentTable:FireClient(player, ServerTable)
--Local script:
local SentTable = game.ReplicatedStorage.SentTable
SentTable.OnClientEvent:Connect(function(ServerTable)
for i, v in pairs (ServerTable) do
print( i, v)
end
end)
simple as that
is this using module scripts? or blindable events?
It’s actually not. ModuleScripts will run one time per Lua environment, which means what you see from the server isn’t the same source available to each individual client.
What you’re referring to is called “caching”, and it’s a valuable concept to learn. Save yourself memory and remote requests by holding identical tables on both the client and the server. At its core, you would use a RemoteEvent to give the player their initial data, and each time a change is made to it you will pass it again (or pass the change itself). If data only needs to be read, you would read the cached table on the client instead of requesting information from the server.
The fact that it remains available on the server, however, is great because it means you can run your sanity checks how you’d like to.