Some elements in the table disappear when transferred from the server to the client

I am making a system for my train with an iframe, when train data is sent from the server (speed, path of the train, etc.), and when a table with parts is sent from the server to the client (this is the path of the train), some parts disappear. I need help!
image

1 Like

If you pass in parts via the network, you’re just passing in a reference to that part. So on the client the client will check if a part exists with that reference and adjust it, otherwise it will just be nil. Conclusion: the parts that are nil probably do not exist on the client. (aren’t replicated).
Same if you pass a part that only exists on the client to the server, it will also be nil.

1 Like

Hey, @scavengingbot, answered your question, I’ll add that it probably happens because you have streaming enabled, or the parts that you’re sending over are somewhere where the Client can’t see them (ServerStorage for example).

Also I don’t see why you would need to send so many parts over, it’s better to send only the most important stuff over and simulate everything on the client.

For example you could send only the model of the train, or a “main” part that you define and get everything else you need on the client. Sending so much data over can cause server lag if done frequently enough

Might want to check this out :

If i were to assume. The parts you sent fall into category of “Non-Replicated Instances”. You said you passed the instance, correct?
Presumably the parts isnt currently replicated to client or isn’t currently rendered, thus passed as nil to player.

My part located at folder at workspace, but some parts have been detected, but others are return as nil.


How to make my parts replicable for the server?

This doesn’t apply here unless you mispoke, this refers to when you create a part in a LocalScript and then try to send it over to the server

If you’re creating the parts on the server and sending them over to the client (Script → LocalScript) then it’s most likely streaming that’s the issue

If you’re trying to create parts on the client and then send them over to the server (LocalScript → Script), then that’s not possible and you should also try to find a different way to do what you’re doing, because it will be possible to exploit it

Out of topic, but I’d recommend creating the table on the Client also, you are sending quite the batch of data to the client, which could potentially limit how much data you can send to the client in the future.

My suggestion is add a Tag on the part and use CollectionService to detect when that Tag is added to a part then add it to a table (Client)

On the other hand if you are sending all this Data fast use a UnreliableRemoteEvent aswell :+1:

The server must create the part, you can do this by “telling” the server to create a part.
Or simply create it on the server

image
I tried, but its the same thing

2 Likes

I solved! I added raycast that adding parts to table, and it works without any problems, but thanks for help!