So I have a bunch of parts, which are randomly created. I spawn them at random times and after 20 seconds, they are destroyed. I also have a system which detects if the player is 100 studs near the part. This system is on the client. If they are, the part is put into workspace, else it’s in replicated storage. The thing is, this kinda messes my system up. If the client puts a part into replicated storage, but the server destroys that part after 20 seconds, will that part still be in replicated storage on the client?
No it wont if something is deleted from the sever then its also deleted from the client.
No, if you were to delete a part on a server it wouldn’t destroy the client.
2 different answers? which one is right?
They’re both right.
If you have any questions, feel free to reach out to me.
a part destroyed from the server WILL be destroyed on the client. But, a part destroyed on the client will be visible to all the other clients that haven’t had it destroyed.
Any changes the server make replicate to the client.
If the client makes any changes, only they can see those changes, as they do not replicate to the server.
The exception to this is if a client has network ownership over a part, then changes will replicate to the server.
For your scenario, the part will only be visible in ReplicatedStorage via the client, as it won’t replicate to the server.
To accomplish this, use a remote event to send the server a request to add the part to replicated storage, and get the server to do the work.
To reiterate, any changes done from the server replicate to ALL clients. Any changes done from a client will NOT replicate to the server.
So if I destroy a part on the server, when that same part is in replicated storage on the client, the part will be destroyed on both client and server?
Yes, as long as the server was the one that created the part and put it in ReplicatedStorage in the first place.
No the client put it into replicated storage.
Where is the part created? On the server, and then the client moves the part locally?
What is your use case for this? This might be a xy problem.
The server creates and destroys the part, the client moves it.
Please clarify if this is correct:
- Server creates part in Workspace or some other location
- Client reparents the part to a different location
- Server destroys part
Im confused how does the sever make and destroy a part then, the client moves it?
Or am I just reading this wrong.
Yes that is correct. The server creates in workspace.
Then the part destruction will still be replicated, as the part is the same.
Then why not have the sever create it in RS?
It’s a render system so the client isn’t laggy.
That checks out. If there’s any questions you have about making a specific render system or a aspect of it feel free to continue the discussion.
I was confused by this discussion so I’m going to write a definite response to clear out any confusion.
The server is superior, it’s the controller that decides what to replicate, and to who. Anything a client does on their end does not replicate to other clients normally.
If you create a part on the server, and replicate that part to every client (player), they will all know the part exists. If one of these clients destroy this part on their end, no other client will notice these changes (unless you added some logic that does it).
Anything a client does on their end never changes for anyone else but themselves, except for animations and walking. If you want something else to replicate, you have to make your own system for it.
If the server destroys the part, it will be destroyed on all clients, since it’s the one in charge ultimately.