Calls a remote event on the remote machine. The server can call remote events for any connected player. Players (clients) can only call remote events on the server. Events are guaranteed to execute in the order sent. Keep in mind that it takes time to reach the remote machine as it's send over the network.
Remote events are independent of packages meaning you can call remote events across different packages.
- Maximum name length of a remote event: 128 characters
- Maximum arguments to pass: 10
- Valid Lua argument types: Integer, Boolean, Number, String, Table
- Maximum String argument length: 8192 characters
- Maximum Table argument dimensions: 3
- Maximum Table keys: 1000 entries
- Valid Table argument keys: Number, Integer, String (32 characters)
- Valid Table argument values: Integer, Boolean, Number, String, Table
CallRemoteEvent(player, EventName [, LuaArgs...])
CallRemoteEvent(EventName [, LuaArgs...])
The player identifier to call a remote event.
The name of the remote event as a string which was explicit defined by AddRemoteEvent.
- UserArgs (optional)
Arguments to pass to the remote event.
- Returns true on success or false on an error.
Script on the server:
function OnPlayerJoin(player) CallRemoteEvent(player, "ServerCallsMe", 1337, 3.1415, "hello client!") end AddEvent("OnPlayerJoin", OnPlayerJoin)
Script on the client:
function ServerCallsMe(arg1, arg2, arg3) AddPlayerChat("Server called ServerCallsMe("..arg1..", "..arg2..", "..arg3..")") end AddRemoteEvent("ServerCallsMe", ServerCallsMe)