How to send instance from server to client?

I’m using a remote event to send a reference to an instance from server to client, but the client reads it as nil

Where is the instance located?

1 Like

What do you mean by a reference to it?
Is the instance located in a place that the client can view?

1 Like

If the instance you’re trying to reference are located in ServerScriptService or ServerStorage it won’t work at all. Both the server and client need to see the same instance for this to work.

1 Like

I’m cloning a projectile from the replicated storage and parenting it to workspace then doing:
remoteEvent:FireAllClients(projectile, isActive)

and on the client i do:

	remoteEvent.OnClientEvent:Connect(function(serverProjectile, isActive)

		print(serverProjectile)

this is really stupid but try printing to see if the projectile exists before you call the remoteEvent

Sending instances across the wire has been a long persisting issue. Perhaps in the future we will be given some Instance ← → identifier methods that allow for a smoother transmission. Until then, I suggest sending the name (or some identifier) of the projectile’s model over the network and cloning it from a prefab locally, if possible.

i found a fix, when i initially clone the part i parent it to replicated storage, then call the event, then finally parent it to workspace

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.