I have a PlayerData table with all the players data, when they join, a Remote Event sends a replica of that table to the Client.
Then when any player data updates on the server I send an update to the client with the information so I can update the replica table.
Obviously the Client and the Server don’t share the same memory (which is why it’s a replica table in the first place) so I would send the path of the element being updated as well as the updated value of that element.
--So lets say banana equaled good but now equals super good, I would send to the client
local exampleTable = {
fruit = {
banana = "super good",
apple = "good",
},
}
local banana = exampleTable.fruit["banana"]
local path_string = "exampleTable.fruit.banana"
local new_value = banana -- value of banana
RandomRemoteEvent:FireClient(randomplayer,path_string,new_value)
-- the client can pick it up and update the replica table
The thing in question is how to get
path_string = "exampleTable.fruit.banana"
I have looked everywhere for the answer but could not find. I know it’s possible because Roblox instances have :GetFullName
which is what I am trying to mimic.
I also looked into Linked Lists, which I don’t fully understand yet, but it seems you store references to different parts of the table in each part of the table, which is how Instances
have things like .Parent
. Not sure if that has anything to do with it.