GetRemote
Provides a simple interface for creating and using remotes. The Remote
object is a wrapper that will dynamically create RemoteEvents,
UnreliableRemoteEvents, and RemoteFunctions based on how it is used,
combining the interface of all three into one for ease of use.
local GetRemote = shared("GetRemote") ---@module GetRemote
local TestRemote = GetRemote("TestRemote")
TestRemote:OnEvent(function(player, ...)
print("TestRemote fired by " .. player.Name .. ", got:", ...)
end)
TestRemote:OnInvoke(function()
return "Working"
end)
TestRemote:Fire("Fired to all clients")
local player = Players:GetPlayers()[1]
print("Client invoke test returned:", TestRemote:Invoke(player))
TestRemote:FireClient(player, "Fired to " .. player.Name)
Functions
GetRemote
GetRemote.GetRemote(name: string,--
The name of the remote
forceLoad: RemoteForceLoad?--
Optionally pre-create specific underlying remote instances
) → RemoteReturns a Remote object for the given name, creating it if it does not already exist. The same object is returned for repeated calls with the same name.