I want to send a folder that’s on the client, which has many descendants whos descendants also have descendants . But of course the server doesn’t recognize it or anything in it? Whats a good way to do this?
Have you tried using a remote event and then sending the folder over?
Of course, The issue is that the server wont recognize the folder, since its comes from the client.
Oh yeah your right, then how about you convert every single value inside of that folder into a table and then pass that table to the server?
I was thinking about that, but im not that experienced around tables. And its not that simple.
When i send it to the server, it must be in the same easy to reference order as the folder is. (i can just go Table.AnnexProvincesMAMLUKS.SummaryDirectory.Value) etc. So it cant just be a random clump of information, it has to have the same structure as it does here.
Hm can I ask what are you going to do with the information that the client sends to the server?
Because what im worried about is that your going to do something important and exploiters may be able to find vulnerabilities and break your game depending on what your planning to do
A player basically lists his demands, sends it to the server, the server then checks for anything fishy, and if his demands are reasonable (anti-hack), then finalizes it.
Why dont you setup that folder like a dictionary, it would make it super easy to just send that information over to the server
Is there a reason you can’t set everything up on the server and use RemoteEvents
to change the information?
Im not quite sure how though, as usually i never use tables.
Nothing, other than the fact i already spent time making it this way
Yeah I think what @Content_Corrupted019 said is a great implmentation, how are you setting up the client folder right now, it would probably easy to just set it up for every player on the server
The descendants of the Demands folder come and go, I just want to know how to send the information of the folder.
if the folder and its descendants are created on the client then I would either A) set everything up to be table based over instance based then you can easily send the dictionary to the server, or B) make a function to convert the instances to a dictionary then send that to the server. I would heavily suggest either making it server sided to begin with or going for the dictionary version.
Of course if this info is important then I would 100% make it all server-sided, otherwise the client can modify it however they want and there’s no way to verify that information.
How would i turn it all into a dictionary and still keep the ordered structure of it? Also, its important to note that in the dictionary it must still retain its values, since most of the descendants are object/number values.
Also the player can modify the folder through the guis I made, or they can modify it through hacks. Either way, when it sends to the server its going to be inspected and checked to make sure theres nothing fishy.
you could make it look something like this (this is just one example)
local t = {
["Demands"] = {
["AnnexProvincesMAMLUKS"] = {
["Provinces"] = {
["Mentese"] = 5
}
},
["Break Alliance"] = {
["Country"] = 1,
["NegotiatingFor"] = 2,
--...
},
}
}
and you could achieve creating this dynamically with a recursive function
This cant work because demands come and go, all the names, values, and layers of descendants arent permenent/constant.
then you could do what I said in my first reply and convert it to a table each time you send it (though not the best for performance)
In my opinion it’d be better to have a cached version of the table stored on the server that you modify with remotes checking each change then instead of verifying every entry each time they update something.
function for this:
The code works beautifully at what its supposed to do, but now I’m just wonder how would I now go about adding the descendants of the children and their descendants etc?
did you pass the Demands folder to the function? It should return a dictionary with everything in it