Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Any way to receive a fired remote event from a client?

Is there a way to detect a remote event being fired by a client from another client? Kind of like what a remotespy script does.

Client firing the event:

game.ReplicatedStorage.Event:FireServer(arguments)

Client 'sniffing' the event:

game.ReplicatedStorage.Event.Fired:Connect(function(arguments)

forgive me if this is a stupid question, new to scripting.

1 answer

✓ Accepted answer

No. Remotes only work from server to client and visa versa. The only way to allow two clients to communicate via remotes is to have the server relay the firing to the correct client. Here's an example of that: Sending client:

RemoteEvent:FireServer(plrToRelayTo, "Hi!")

Server:

RemoteEvent.OnServerEvent:Connect(function(plr, plrToRelayTo, msg)
	local sender = plr
	-- Optional logic to check if client is actually allowed to do this
	RemoteEvent:FireClient(plrToRelayTo, sender, msg)
end)

Receiving client:

RemoteEvent.OnClientEvent:Connect(function(sender, msg)
	print("From: " .. sender .. ": " .. msg)
end)

If my answer solved your problem please don't forget to upvote and accept it.

This discussion is preserved as it was. New answers, comments, and votes are closed.