sm

The sm namespace contain all API features related to Scrap Mechanic.

Constants:

Functions:

  • exists
  • isServerMode

  • sm.isHost boolean

    Returns whether the game is currently running on the hosting player's computer.


    sm.version string

    Returns the current version of the game as a string.


    sm.exists(object)

    Returns whether an object exists in the game. This is useful for checking whether a reference to an object is valid.

    Parameters:

    TypeNameDescription
    anyobjectThe object instance.

    Returns:

    TypeDescription
    booleanWhether the object exists.

    sm.isServerMode()

    Returns whether the script is currently running in server mode. Otherwise, it is running in client mode. Server mode only occurs when sm.isHost is true.

    Returns:

    TypeDescription
    booleanWhether the script is running in server mode.