Api > Script > OnOwnerChanged()
Script.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:⚓︎
Name | Type | Description |
---|---|---|
player | MLPlayer | The new owner player |
Usage⚓︎
local script = LUA.script;
--- OnOwnerChanged message from Script
---@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