Can you send instances through events?

Hi, I was wondering why my script is not working. I’m trying to set a highlight’s enabled propriety on client but this error appears:

Server:

if v:FindFirstAncestor(Stage.Name) then
			ReplicatedStorage.Highlights:FireClient(player, v, true)
		else
			ReplicatedStorage.Highlights:FireClient(player, v, false)
		end

Client:

local HighlightsEvent = game.ReplicatedStorage:WaitForChild("Highlights")

HighlightsEvent.OnClientEvent:Connect(function(instance, bool)
	instance.Enabled = bool
end)

Any help is appreciated!

I’m a mid coder, and without further context, i cant really say. However, I would troubleshoot by printing something at every step of the way, like “a” on one step, or “b” on the other. I would also try printing the instance on the “HighlightsEvent.OnClientEvent:Connect(function(instance, bool)” function. Maybe you are trying to pass the wrong object?

Yes, you can send an instance through remote event parameters but both the client and the server have to be able to see it.
For example, if the server is sending something that is in ServerStorage, player clients will recieve it as nil as they cannot access anything inside ServerStorage.

It’s a highlight located in the workspace and both client and server can see it.

I’m pretty sure you can’t send an instance through an event. Try passing something it can be identified by, like a name, for example.

just pass the instance’s name, and then have workspace or a certain model check for the instance like this:

if workspace:FindFirstChild(InstanceName) then
      workspace:FindFirstChild(InstanceName).Enabled = bool
end