Multi-Receiving Remotes

I have this table


                    ["Announce"] = ReplicatedStorage,
                    ["GiveTOOLS"] = ReplicatedStorage,
                    ["KillPlayer"] = ReplicatedStorage,
                    ["MutePlayer"] = ReplicatedStorage,
                    ["TrollPlayer"] = ReplicatedStorage

And I want to loop threw and check If said remotes are ever fired,
Argument 1 is the remote name, Argument 2 is the service where its located.

I dont understand clearly what you want to achieve, you mean connect those remotes to listen the OnServerEvent and OnClientEvent?
Like this?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local REMS = {
	["Announce"] = ReplicatedStorage,
	["GiveTOOLS"] = ReplicatedStorage,
	["KillPlayer"] = ReplicatedStorage,
	["MutePlayer"] = ReplicatedStorage,
	["TrollPlayer"] = ReplicatedStorage
}

local function remEvent(plr, rem)
	warn(rem, "fired by:", plr)
end

for rem, location in pairs(REMS) do
	if location:FindFirstChild(rem) then
		location[rem].OnServerEvent:Connect(function(plr)
			remEvent(plr, rem)
		end)
	end
end
1 Like

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