Is it possible to get a RemoteEvent to be read from multiple scripts?

checkToys.OnClientEvent:Connect(function(...)
	local tuple = {...}
	if tuple then
		inner:FindFirstChild('TeddyBear').Quantity.Text = tuple[1]
		inner:FindFirstChild('Ball').Quantity.Text = tuple[2]
		inner:FindFirstChild('Yo-Yo').Quantity.Text = tuple[3]
		inner:FindFirstChild('Slinky').Quantity.Text = tuple[4]
	end
end)

Different script

checkToys.OnClientEvent:Connect(function(...)
	local tuple = {...}
	if tuple then
		toysFrame:FindFirstChild('TeddyBear').Quantity.Text = tuple[1]
		toysFrame:FindFirstChild('Ball').Quantity.Text = tuple[2]
		toysFrame:FindFirstChild('Yo-Yo').Quantity.Text = tuple[3]
		toysFrame:FindFirstChild('Slinky').Quantity.Text = tuple[4]
	end
end)

It only works with one of these functions however. I want when the event is fired to be working in both these functions. I was told previously that RemoteEvents can be checked in an endless amount on scripts, so I don’t get why now it only wants to fire one of the event and not the other. It’s not got anything to do with the code above either of these scripts, as I put a print before each functions and it printed the print, but when I put a print inside each function, it only printed one of them

Most likely one of the scripts is disabled or there is something yielding your code before the event is connected.

On a side note your if statement is useless. No matter what it will always return true because currently all you are doing is verifying that a table was created, which is pointless as you created it in the line above. A more suitable check would be something like

if #tuple == 4 then
--Code
end
1 Like

Theres nothing in the code to prevent the function from firing. Both scripts are enabled. And I had put a print in both scripts the line before the function fired and immeditaly after it fired. 1 script printed both prints, the other only printed one, so the script was not firing the function

Well yeah. OnXEvent are connections. They’re the same as connecting to, say, PlayerAdded several times. This is a problem with your code.

Also, why are you redundantly hooking the same content twice across two different scripts?

Two seperate frames with two seperates data in each.

…? Can you not just use a single script and transfer that data over or make it in such a way that received data can be used across your client?

Made a simple test place to figure this out. Multiple local scripts receive the event with no issue, so it must be some other part of your code preventing it.

MultipleEvents.rbxl (20.0 KB)

This is a design flaw with RemoteEvents.