Dispenser.GetOwner
Skip to content
mnscript
Player Dispenser.GetOwner() 

Description ​

Gets the Player who owns this dispenser.

Returns ​

Player - The Player who owns this dispenser.

Example ​

msc
using Peripheral;
using Console;
using Application;
using Player;

Dispenser dispenser = Peripheral.GetConnectedDispenser();

if(dispenser.IsValid() == false){
    // If the dispenser was not found, quit.
    Application.Exit();
}

// Prints the name of the dispenser's owner in console.
Player owner = dispenser.GetOwner();

Console.WriteLine("The dispenser is owned by "..owner.GetName());