A more in-depth tutorial on Skript Events.


Triggers, or "Events", in simple terms, when something happens.

<code to run>

Since listening for an event, starts a new section, you need to include the colon after the event.

on chat:
set message to "&c%message%"

Although it can be controversial, you don't have to put 'on' before your events. Some would argue its sloppy, but its all up to you.

In the example above, Skript is listening for when a player chats. Once a player chats, it will run the code below. (In the example, it would make the player's message colored red)

Periodical (Timed) Events

Skript also has periodical events.

every 30 seconds:
loop all players:
send "Hello!" to loop-player

Reference the example above. Using this code on your server, every 30 seconds, every player would be sent "Hello!"

Event Values

Different events, have different event values. When browsing Skript documentation sites like Skript Hub, you might find that there is a list of event-values for certain events.

on break:
send "You just broke %event-block%!" to player

In the example above, we're using the on break event. The event is triggered when a player breaks a block. The break event has the 'event-block' event value. Event-block is the block the player broke in the event.

on chat:
send "%message%"

The chat event has the message event-value. The message, is whatever the player typed into chat. For some event-values, you do not need to include event-(value). Ex. event-player, event-message.

on death:
send "You got a kill!" to attacker
send "You died!" to victim

In the example above, you can't use player, because it is a death event. The two player event-values are attacker, and victim. Attacker being the person who killed the victim.

Cancelling Events

Some events can be cancelled. Some cannot.

on death:
cancel event # This will not work

In the event above, there is a death event. The death event cannot be cancelled, and Skript would throw an error.

on break:
cancel event

In the example above, we're cancelling the break event. This can be cancelled. Most (Not all) documentation sites for Skript will specify whether the event can be cancelled.


You've just learned how to use events in Skript!