FireLocalServer

Constructor:

FireLocalServer(...)

Description

Server script sends an event to the local server script.

Parameter

Name Class Name Description
Tuple Passing parameter

Examples

Send a server event when an avatar hits a part. Print the received parameter when the server event is received.

local obj = RWObject.Create("Part") -- create a part
local eventobj = RWObject.Create("EventObject") -- create an event object
eventobj.ServerEventCallBack:Connect(function(res1,res2) -- define the server callback event
    print("Triger a local server event." .." The passing parameter 1 is: " ..tostring(res1).." The passing parameter 2 is: " ..tostring(res2)) -- print the received parameter
end)
obj.TriggerEnter:Connect(function(res) -- trigger the event when the part is hit.
    if res:IsClass("Avatar") then -- when the hitting object is an avatar
        eventobj:FireLocalServer("222","333") -- send a server event
    end
end)