Bug regarding sending instances from Server to Client through Remote

I realized that in newly created places, you cannot send instances from Server to Client through Remote. Let’s say that you are firing a remote from the server side to the all clients, and the argument is an object from workspace.

– Server script in StarterCharacterScripts
task.wait(5)

local character = script.Parent
local part = Instance.new(“Part”)

part.Parent = workspace

local parts = {character, part}

game.ReplicatedStorage.TestEvent:FireAllClients(parts)

– Client Script
game.ReplicatedStorage.TestEvent.OnClientEvent:Connect(function(array)
local char, part = table.unpack(array)
print(char, part)
end)

Usually the client script will print out both the character and the part’s name like “EclipDDia Part”. This is still functional in old created places. In new places that was created a few days ago however will only print out “EclipDDia nil”, which is not supposed to happen.

This is likely due to the fact that all templates, used to create new places, were recently changed to be streaming enabled. When streaming is enabled not all parts will be replicated to all clients. What parts the clients receive will depend on where the parts are relative to the client’s character, among other factors.

A typical way to deal with this behavior is to use WaitForChild in the client script to wait for the part to arrive. Keep in mind that some parts may never be sent to the client if they are always far away from the character, for example.

1 Like

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