More code would help but I would say to make sure the table is initialized before any of the threads try accessing it. If that’s not it, maybe the synchronization might not be setup correctly.
probs best to create a function to change the main table then pass that function pointer to each actor so they can then use it to call the function when they want to update the table…
There are multiple different ways, but bindable events are the most simple option to obtain data back from threads. Also, when I tested _G with multithreading, I got the same issue with not being able to get data in the thread. I think _G cannot be accessed between actors. What I would do is send a second variable in named worldStructures instead of retrieving it through _G.
Edit: I just realized you tried doing that, I would try to put the needed functions in the actor script and retrieve it from there. Probably not the best but it would work.
I attempted to send a function that would allow me to add to the table (thought this hacky solution would work, it did not)
sending it as the current table could work, but it would just lead me back to using bindable events which if i remember correctly can slow down cause of intense bandwith, correct me if im wrong though
also, _G is a new table in every actor, but I thought synchronizing back to the main thread would get me back the _G, but it did not which is unfortunate
Bindable Events would not cause lag by networking. Your thinking about Remote Events. Remote Events are used for server/client or client/server communication, while bindable events are used for scripts from server/server or client/client communication.
Sending a function through wouldn’t work, and would just error like above. Could you put a copy of the function in the actors and use it from there? That might work, but I’m not sure if you need the function in the other script or not.
If bindable events work, and aren’t causing networking lag then yeah it works fine and can set the main table by firing it in the actor, best part is that they can run parallel as well.
thank you for the help.
EDIT: further testing and bindable events didn’t effect performance at all and if it did, it was very minimal, got 50k structures loading in <5 seconds. i appreciate everyone who postedhere for the help