Is it something that I am doing wrong or is it roblox's problem (Multihreading)

So I encountered a problem, it’s about how roblox handles tables…

--Script nr. 2 thread. 2 (TerrainThread)
    print(Request) --Output table: 0x33af95b7351fe746  {}
--Script nr. 1 thread. 1 (MainThread)
local Request = {}
print(Request) --Output table: 0x7ad052d6cc36a076  {}

How do I make so the tables are the exactly the same?
It’s a problem because the main thread is going to read changes that will never happen, basically corking all of the system.
Time is a problem too…

How it looks like in explorer:

1 Like

Neither you and Roblox are wrong. Luau was designed so that the table is copied, since this would fit most developer’s needs without making the language more complex (introduce pointers, references, etc.). Perhaps if the table used more memory, then it could actually just be a reference (I’d expect an optimization).

try to use


I already did, and it worked exactly the same as if with tables

1 Like

Can I somehow share this table to other thread?

1 Like

If you’re going to make these, It’s best to use module scripts.

1 Like

How is that going to help? Like I am 99% sure that it’s going to give 2 different tables if I require it from different threads…

1 Like

Try the theory out, I guess. [][][][][]

The theory didn’t work. Thank you for trying anyways.


Huh? _G one and only use over tables is that its shared over all script environments (client, server and console)

Just use module scripts if its much of a problem, also do you need tables to replicate changes or just to send raw data?

If you haven’t noticed, modules don’t work, they can’t be shared in between threads.
What I am trying to get to achieve is a terrain system which loads up chunks in a prepared table, without making it take too much memory. That’s why I tried _G, but seems like it’s quite different as expected and you know the rest of the story…

Well, you are quite wrong, luau doesn’t copy tables when you pass it into normal function arguments…
References exist in roblox in that case.

RBXScriptSignal does, so you’re going to want to find an alternative signal class. GoodSignal by sleitnick is a good candidate.