Server Handler

Server Handler

This package works in the exact same was as Local Handler by Adam, except for sending events back to the server. It is quite literally the exact same code, but backwards. All credit to Adam.

SendToServer requires the recipient to be a user or character. This means if you use DoOnLocal on a world object, you can’t use SendToServer to send a message back to the server.

This package alleviates that problem.

Usage:

function MyWorldObject:DoneOnClient()
  local user = GetWorld():GetLocalUser()
  user:SendToScripts("DoOnServer", self:GetEntity(), "DoneOnServer", math.random())
end

function MyWorldObject:DoneOnServer(value)
  self.properties.foo = value
end
1 Like