RemoteEvent
Inherited from BaseObject
new
When used on the Server the 1st argument should be the RemoteEvent's name, the 2nd argument is the parent
local remoteEvent = RemoteEvent.new("RemoteEventName", workspace)
When used on the Client the only argument should be a Roblox RemoteEvent instance
local remoteEvent = RemoteEvent.new(workspace.RemoteEventName)
Connect
When used on the Server this behaves like OnServerEvent:Connect()
and when used on the Client it behaves like OnClientEvent:Connect()
local connection = remoteEvent:Connect(function(...)
-- On the server this would print the Player
print({...}[1])
end)
connection:Disconnect()
Fire
{internal}
When used on the Server this behaves like FireClient()
and when used on the Client it behaves like FireServer()
-- Server
remoteEvent:Fire(player, ...)
-- Client
remoteEvent:Fire(...)
FireAllClients
{server-only} {internal}
Behaves like the normal FireAllClients()
remoteEvent:FireAllClients(...)
FireWhitelistedClients
{server-only} {internal}
Fires the event for all players in a list
remoteEvent:FireWhitelistedClients({player1, player2, player3}, ...)