Skip to content

Tutorials: Methods & Access Modifiers

nova ✩ edited this page May 18, 2026 · 18 revisions

Methods

A method is a function that is class-specific, the signature is identical to skript functions.

class example:
    method helloWorld():
        broadcast "hello world"

    method getBalance(p: player) :: number:
        return balance of {_p}

Calling methods:

set {_example} to new instance of example

{_example}::helloWorld()
set {_balance} to {_example}::getBalance(player)

Private/Public Access

By default methods and fields are public, meaning they can be accessed from anywhere as long as there is an instance available. You can prefix methods and fields with the private modifier to restrict their access to only within the same class

Clone this wiki locally