Skip to content

Network Variables

Ahmad Saleem edited this page Sep 4, 2026 · 7 revisions

Network variables

A network variable is a normal Skript variable with a ? in front of the name.

set {?coins::%uuid of player%} to 100

That value now exists on every server. Any server can read it or change it.

Variables without the ? stay on the server they were written on.

set {coins::%uuid of player%} to 100   # only this server
set {?coins::%uuid of player%} to 100  # the whole network

Reading is free

Your server answers reads from its own copy in memory. Nothing goes over the network.

send "You have %{?coins::%uuid of player%}% coins"

It's as fast as a normal variable. Use it in a loop, in on damage, anywhere.

Writing goes to the proxy

Your server sends the change to the proxy. The proxy stores it and tells every other server.

set {?rank::%uuid of player%} to "vip"

Every write is one message. A script that writes every tick for every player will slow the whole network down.

What you can store

Text, whole numbers, decimals, true/false, and dates all work.

set {?name::1} to "eult"        # text
set {?score::1} to 42           # whole number
set {?rate::1} to 1.5           # decimal
set {?vip::1} to true           # true or false
set {?seen::1} to now           # date

Values are turned into bytes to travel between servers, and a few Skript types don't survive the trip. Items with custom names or enchantments are the usual problem. If a server can't read a value, it logs a warning and that one variable is missing there. See Limitations.

Checking if something is set

if {?coins::%uuid of player%} is not set:
	send "No account yet."

Careful at startup. Before the first sync your copy is empty, so this says yes for everyone. Read Sync and events first.

A default value is usually simpler:

send "You have %{?coins::%uuid of player%} ? 0% coins"

Lists

Lists work how you'd expect.

add "alpha" to {?team::red::*}
add "bravo" to {?team::red::*}

send "%size of {?team::red::*}% players"

loop {?team::red::*}:
	send "- %loop-value%"

remove "bravo" from {?team::red::*}

Skript stores each entry under its own name, so each add is one normal write.

Deleting a list

delete {?team::red::*}

This removes every entry under team::red and nothing else, not even names that start the same way:

set {?team::redstone} to "safe"
delete {?team::red::*}
# {?team::redstone} is still there

Deleting a big list is the slowest thing you can ask the proxy to do, because it has to check every variable it holds. Don't do it to huge lists while players are online.

You can't set a list name

set {?team::red::*} to "x"   # refused

A name ending in ::* can only be deleted. Add entries one by one instead.

Deleting a single variable

delete {?coins::%uuid of player%}

The variable disappears everywhere.

Naming

Use :: to group related values, same as normal Skript.

{?eco::bal::%uuid of player%}
{?eco::joins::%uuid of player%}
{?online::lobby::*}

Groups help with /sknetproxy dump on the proxy, because you can look up a whole group at once:

/sknetproxy dump eco::bal::*

Use a player's UUID, not their name. Names change, UUIDs don't.

Changing the prefix

? is the default. Change it in plugins/skNetwork/config.yml:

prefix: "$"

You also have to change the pattern in plugins/Skript/config.sk to match. skNetwork does that for you when force-skript-config is on. See Configuration.

You can't use #. It starts a comment in Skript's config file.

The prefix is stripped before a name is sent to the proxy, so two servers using different prefixes still share the same data.

When two servers write at the same time

# WRONG on a network
if {?coins::%uuid of player%} >= 100:
	remove 100 from {?coins::%uuid of player%}

If two servers run this at the same moment, both read the old number and both subtract. One subtraction is lost and the balance can go below zero.

Use Atomic changes for anything you count:

atomically remove 100 from {?coins::%uuid of player%} without going below 0 and wait
if the atomic change succeeded:
	give player a diamond

See also

Clone this wiki locally