Skip to content

PlayerChangeWorldEvent

Triggered whenever a player is moved to a different world. This event cannot be canceled.

When this event is fired, the player has already been teleported to the destination world.

Example

local queue = spell:collect("PlayerChangeWorldEvent")
while true do
  local evt = queue:next() ---@cast evt PlayerChangeWorldEvent
  print("Player " .. evt.player.name .. " just entered " .. evt.destination.dimension)
end

Fields

name: string Read-Only

The name of this event.

player: Player Read-Only

A reference to the player who changed worlds.

origin: World Read-Only

A reference to the world the player left.

destination: World Read-Only

A reference to the world the player entered.