Skip to main content

LuaBehaviour.OnOwnerChanged(MLPlayer player)

OnOwnerChanged called when the current Network owner is changed. The new owner is passed as argument. Network ownership allows a certain client to modify properties of a game object if that game object or any of its parent or grandparents are synchronized using MLSynchronizer.

Parameters:

NameTypeDescription
playerMLPlayerThe new owner player

Usage

local script = LUA.script;

--- OnOwnerChanged message from LuaBehaviour
---@param player MLPlayer
function script.OnOwnerChanged(player)
-- your code here
end

Example

do
local script = LUA.script;

function script.OnOwnerChanged(player)
Debug.Log("New Player is: " .. tostring(player));
end
end