Oh this is probably due to the function returning before it’s actually parented.
A thing that happens a lot when using invokes especially when returning instances is that it’ll just return the instance as soon as it’s created, and won’t wait for it to be parented.
try yielding until armReplica.Parent ~= nil
alternatively, just have the client do :WaitForChild(), and turn it into a RemoteEvent instead.
i think this bug will only happen if you have StreamingEnabled on in the workspace properties, and it is happening because the cloned part takes time to replicate to the client. See if turning off streamingenabled fixes the issue
No, it doesn’t occur due to streaming enabled, it’s due to how RemoteFunctions work, RemoteFunctions are directly connected to server runtime, Remotes do their best to return values as quick as possible to prevent infinite yields and server memory leaks. Hence why when you use remotes to return a value, as soon as the value itself does not equal nil, it will be returned.
Since think of return with RemoteFunctions as promises, they are asynchronous with the function to maintain the best performance for the server.
I take back my statement, it could be caused due to streaming enabled, sorry, since streaming enabled does affect the replication runtime efficiency to workspace. (Synchronizes workspace changes, Improved performance section)
Dev forum: