Skip to main content
Scripts are the foundation of Skript. They are text files with a .sk extension that contain code written in Skript’s plain English syntax.

Creating a Script

Scripts are stored in the plugins/Skript/scripts/ folder on your server. Create a new file with the .sk extension:
plugins/Skript/scripts/my-script.sk

Script Structure

A script consists of:
  • Events: Triggers that execute code when something happens
  • Commands: Custom commands players can run
  • Functions: Reusable code blocks
  • Variables: Data storage
Each element must be properly indented using tabs. Indentation determines which code belongs together.
on join:
	set the join message to "Oh look, %player% joined! :)"

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

Loading Scripts

Skript automatically loads all scripts in the scripts folder when the server starts. You can also reload scripts without restarting:
/skript reload <script-name>
/skript reload all

Script Organization

Organize your scripts by functionality. Create separate files for different features instead of one massive script.
Good organization:
scripts/
  commands/
    moderation.sk
    utility.sk
  events/
    player-events.sk
    world-events.sk
  functions/
    helpers.sk

Comments and Documentation

Use # for comments to document your code:
# This example listens for players joining and leaving.
# Alters the default message when they do.

on join:
	set the join message to "Oh look, %player% joined! :)"

Aliases

Define aliases at the top of your script to group items:
aliases:
	custom helmets = iron block, gold block, diamond block
	blacklisted = TNT, bedrock, obsidian, spawner, lava, lava bucket

Example: Complete Script

Here’s a complete example from the Skript source showing multiple concepts:
#
# A simple broadcasting function example.
# This demonstrates how to declare and run a simple function.
#

function say_message(message: text):
	broadcast {_message} # our message argument is available in `{_message}`.

on first join:
	wait 1 second
	say_message("Welcome, %player%!") # Runs the `say_message` function.

#
# An example of a function with multiple parameters and a return type.
# This demonstrates how to return a value and use it.
#

function give_apple(name: text, amount: number) :: item:
	set {_item} to an apple
	set the name of {_item} to {_name}
	set the item amount of {_item} to {_amount}
	return {_item} # Gives this value to the code that called the function.

command /appleexample:
	permission: skript.example.apple
	trigger:
		send "Giving you an apple!"
		set {_item} to give_apple("Banana", 4)
		give player {_item}
Always use tabs for indentation, not spaces. Mixing tabs and spaces will cause syntax errors.

Debugging Scripts

When a script has errors, Skript will show them in the console when loading. Common issues:
  • Indentation errors: Check that you’re using tabs
  • Syntax errors: Verify your syntax matches Skript patterns
  • Invalid expressions: Make sure expressions are used in valid contexts
Use /skript reload <name> to test changes without restarting the server.

Next Steps

Events

Learn how to respond to Minecraft events

Commands

Create custom commands with arguments

Build docs developers (and LLMs) love