Skip to main content
Events are triggers that execute code when something happens in Minecraft. They form the backbone of most Skript functionality.

Basic Event Syntax

Events start with the on keyword followed by the event name:
on <event>:
	# your code here

Common Events

Here are some frequently used events:
on join:
	set the join message to "Oh look, %player% joined! :)"

on quit:
	set the quit message to "Oh no, %player% left! :("

on first join:
	wait 1 second
	send "Welcome to the server!" to player

Event Values

Events provide special values you can access:
  • player - The player involved in the event
  • event-block - The block involved in block events
  • event-item - The item involved in item events
  • victim - The entity that took damage
  • attacker - The entity that caused damage
  • event-entity - The entity involved in entity events
on death:
	victim is a player
	if attacker is a player:
		send "You were killed by %attacker%!" to victim
		add 1 to {kills::%uuid of attacker%}

Filtering Events

Add conditions directly after the event line to filter when the event triggers:
on inventory click:
	event-slot is the helmet slot of player # Check that player clicked their head slot.
	inventory action is place all or nothing
	player has permission "skript.example.helmet"
	cursor slot of player is custom helmets # Check if the item is in our custom alias.
	cancel the event
	set {_old helmet} to the helmet of player
	set the helmet of player to the cursor slot of player
	set the cursor slot of player to {_old helmet}

Canceling Events

Many events can be canceled to prevent their default behavior:
on damage:
	victim is a player
	victim has permission "god.mode"
	cancel event # Player takes no damage
Not all events can be canceled. Check the documentation for specific events to see if cancellation is supported.

Custom Inventory Events

You can create interactive menus using inventory events:
command /chestmenu:
	permission: skript.example.menu
	trigger:
		set {_menu} to a new chest inventory with 1 row named "Simple Menu"
		set slot 4 of {_menu} to stone named "Button" # Slots are numbered 0, 1, 2...
		open {_menu} to player

on inventory click: # Listen for players clicking in an inventory.
	name of event-inventory is "Simple Menu" # Make sure it's our menu.
	cancel event
	if index of event-slot is 4: # The button slot.
		send "You clicked the button."
	else:
		send "You didn't click the button."

Event Priorities

When multiple scripts listen to the same event, you can control the order with priorities:
on join with priority highest:
	# Runs before other join events
	
 on join with priority lowest:
	# Runs after other join events
Available priorities: lowest, low, normal, high, highest, monitor

Complete Event Example

Here’s a real example from the Skript source demonstrating event filtering and conditions:
#
# This example allows players to wear specified blocks as hats.
# Listens for the clicking in the head slot and, if the player has permission, puts the item on their head.
#

aliases: # An alias for our allowed hat items.
	custom helmets = iron block, gold block, diamond block

on inventory click:
	event-slot is the helmet slot of player # Check that player clicked their head slot.
	inventory action is place all or nothing
	player has permission "skript.example.helmet"
	cursor slot of player is custom helmets # Check if the item is in our custom alias.
	cancel the event
	set {_old helmet} to the helmet of player
	set the helmet of player to the cursor slot of player
	set the cursor slot of player to {_old helmet}

Event Categories

  • on join / on quit
  • on first join
  • on death / on respawn
  • on chat
  • on command
  • on teleport
  • on consume
  • on break / on place
  • on block damage
  • on grow
  • on ignite
  • on explode
  • on physics
  • on spawn
  • on death
  • on damage / on heal
  • on combust
  • on target
  • on shoot
  • on inventory click
  • on inventory open / on inventory close
  • on inventory drag
  • on inventory move
  • on pickup
  • on drop
Use /skript reload <script> to test your event handlers without restarting the server.

Next Steps

Effects

Learn how to perform actions in events

Conditions

Filter events with conditional logic

Build docs developers (and LLMs) love