# Periodical Events

Periodical events are special events that occur, well, periodically. They will be continuously triggered every so often. For example, `every 2 hours:` will run every 2 hours once the script is loaded.

{% hint style="warning" %}
Note that periodical events **do not have event-values**. This means you cannot use the `event-player` expression inside a periodical event. All objects used in periodical events must be accessed some other way, such as global variables.
{% endhint %}

***

## Abuse

Many new Skript users do not realise how truly diverse Skript's event selection is; not bothering to check if there's an event that is already perfect for their needs. This leads them to abuse a periodical event when it is not necessary or practical.

Since periodical events do not have event-players, those who abuse periodical events then loop all players inside of the periodical event so they can access a player through the `loop-player` expression. This is even more inefficient because now the script is looping many players, most of which the code is irrelevant to, and being run when it might not need to.

{% hint style="success" %}
Always scour the documentation to find events designed for your ideas. Use them to host your code.
{% endhint %}

Some common projects that lead to abusing periodical events:

* For auto-compressors, use the `on pick up:` event
* For giving rewards to players in an AFK region, use the `on region enter:` or `on bound enter:` events
* For weapons or armour abilities, to detect when a player equips a tool or armour piece, use `on hand item swap:`, `on tool change:`, and `on armour change:`
* For scoreboards, use `on join:` and a `while player is online:` loop.
  * If your scoreboard is static (not changing), also consider setting it only once when the player joins, as it does not need to be updated.
  * If there are only a few values that change occasionally, only update it when needed. For example, if you are displaying the player's death count, you only need to update it when the player dies.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://x8ight.gitbook.io/syntask/fundamentals/structures/events/periodical-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
