RemoteEvent returning nil

I am having an issue with duplicating a model originating from a local script with a remote event, the problem being that it returns nil

Local script

local bulb = char:FindFirstChild("meleeBulb")
tool.collectBulbEvent:FireServer(bulb)

Server script

collectBulbEvent.OnServerEvent:Connect(function(player, bulb)
	print(bulb)
	local bulb = bulb:Clone()
	bulb.Parent = workspace
	bulb.PrimaryPart.Anchored = false
end)

Does anyone know why this happens?

Is blub created on the client side?

cause remember the server cannot see what the client creates

Yes it is, but I use a remote event to define bulb in the server script

The problem is, the bulb from the client is nil on the server, because anything you do on the client doesn’t replicate to the server. That is why the bulb parameter on the server is nil. The bulb on the server is just nil too, because you’re essentially trying to clone nil, which is just nil.

Try creating the bulb on the server instead, so the server will actually register that bulb exists.

1 Like

thanks for explaining it better.

1 Like

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