Is there a way to send instances from client to server?
If I fire a instance that only exists on client, it returns nil on the server.
You donât. The server would need to reconstruct the instance on their end if they wanted to work with it.
You could have the instance created by the server and managed by the client instead unless you require the client to be the creator of the instance and it shouldnât be replicated to other clients. If the client creates it then youâll need a purely data-oriented approach to âworkâ with it on the server.
Instances are sent as references through remotes so if the environment canât acquire the reference then, as youâve seen, itâs nil. The server does not have any references to client-created instances like how the client doesnât have any references to descendants of server-sided services. These references canât be created by the developer.
Well what if you just send every property of instance even the class name?
If that helps you in reconstructing the instance but I donât particularly think thatâs practical. Could you detail your exact use case and scenario? What are you trying to accomplish here that requires you to send a client-created instance to the server?
Basically, I want all of playerâs gui and it being sent to another client, being viewable to another client.
In this case itâd be more sound for the âreceivingâ client to reconstruct the Guis on their own end and then have the âsendingâ client replicate instructions via the server for the receiver to follow. In most cases of hand replication you donât want to actually reconstruct any instances but instead communicate changes with data and then present them on the current clientâs display.
do it directly on the server
But how would I get all of instance properties? there is no function like âGetProperties()â
Just made this module for you for that purpose.
Usage:
- Require the module anywhere on the server (this will set up the properties for the client)
- Now you can require it on either the client or server and use it as this:
local methods = require(...)
print(methods:GetProperties(workspace)) --> {...}
Go to the settings gear next to the properties panel and turn off âlog modeâ. Itâs a table viewer when you do that, it returns a table with the properties but that visualizes it for you.
I tried sending properties to the server and itâs doing nothing.
Try to fix something here:
place.rbxl (238.1 KB)
Try making a instance in workspace but in client, then check it if it exists on server.