A question about local parts

Hello! When I make appear a part with a local script. Only client of local script can see or interact with this part but I would like if it is a good idea to make appear parts on server and destroy this part with local scripts of all client except one to make interact server with this part. Could you answer me to my question please?

Sure, but why do you want to do this?

I am not completely sure I understand your question. Yes, there is a client-server boundary, and only certain exceptions replicate from client to server as well as from client to all other clients. This means that clients can do almost whatever comes to their mind in their own game replica, e.g. create lots of parts etc., but none of it replicates. In case you’d like to have a part destroyed by client and for everyone, you’ll have to use remote events to send requests to the server. As you know already, clients can create parts only for themselves to see, and conversely, they can also destroy parts for exclusively for themselves.

To answer your question (if I understand it correctly), you can send a remote signal to all clients. There isn’t really a point to doing this, but you could insert a remote event in ReplicatedStorage, and use :FireAllClients(). Client-side, you would accept that signal using event.OnClientEvent() and call a function to destroy a particular set of parts.

Again, what is the point of this? None really, because no clients will see that part, while it will still exist on the server. That part will be pretty much useless and a waste of memory. It could theoretically be used as an invisible barrier or moving object etc., but why not simply create an invisible part instead (?).

1 Like

You could just create the part on the client and have the server send remotes to that one player telling them how to manipulate the part.

You did’t really unterstand my question.

  • I wanted part are existing in a client and in the server and not only in the server or only the client.

  • I knew aleady the solution. I just wanted if that was a good idea to do this to make interact client part with server scripts (Like tools).

I think what he meant, was whether he should use one method over the other. Method one was creating a part for the client through a local script, easy peasy. Method two however, was creating a part for the server, and then destroying it from all clients except for one.

What he wants to know, is which one is the better choice to use.

2 Likes

Well, the better choice is obviously the one that is easier and requires less components and processing time, which is of course without doubt the first option. The other option demands destroying the part from every workspace that is not involved, which is pointless and performance unfriendly.

Why doesn’t it make a point? Albeit it is true that if only one client and server see the part, server can control what client does with that part. At the same time, we return back to the previous question.
Why isn’t that useful? Because it’s unnecessary burden for the server. Server “doesn’t care” what client does in their own workspace, and usually can’t prevent it. The only concern is how that behaviour and acting affects other clients and the gameplay. So it’s unnecessary to do that. At the same time, if server gives network ownership over that part to the individual player, they do simulate physics, but server keeps control over it. Client can destroy that part, but it will stay unchanged on the server.

Stick to the first method. Either create parts on the server for everyone, or create a part from local script in order for it to only be visible to the client. Nothing else really makes sense, because of the above reasons.

I hope this answers your question. As far as the previous post goes, I may not have fully understood your questions, because it was a big confusing, but the post still holds some information that I could reference here. Even though it may not be the direct answer, you can make your conclusions from the information it provides. I try to write comprehensive posts, so looking again at the previous one, it does include your partial answer between the lines.

I hope this helps.

The reason your only seeing the part on your client is due to a feature called Filtering Enabled. This ensures that no matter how much damage a client does, it will not be replicated to the server.

Example:

Player 1 destroys the map
Player 2 doesn’t see that because filtering enabled blocks it.

If you would like a part to Replicate on server and client, make the part through a Script. Either that or use events which I highly advise you protect the events or don’t use them at all as they can be abused very easily, so I’d suggest making the part by a script.

1 Like