Skip to main content

sm.portal

Associated object type: Portal

A Portal is a box-shaped trigger that can be used to teleport its contents to another location.

warning

This feature is very sensitive to "wrong" use and requires careful scripting to avoid triggering race conditions, bugs or game crashes.

Functions

addWorldPortalHook

sm.portal.addWorldPortalHook(world, name, portal)

Server-Only

Adds a hook that a new world can find to hook up the other side of a portal.

Parameters:

  • world (World): The target world.
  • name (string): The name of the portal.
  • portal (Portal): The portal.

createPortal

local portal = sm.portal.createPortal(size)

Server-Only

Creates a new portal.

Parameters:

  • size (Vec3): The size.

Returns:


destroy

sm.portal.destroy(portal)

Server-Only

Destroys a portal.

Parameters:


popWorldPortalHook

local portal = sm.portal.popWorldPortalHook(name)

Server-Only

Finds and pops a portal hook for this world if present.

Parameters:

  • name (string): The portal name.

Returns:

  • (Portal): The portal. Nil if nothing was found.