Online Variables let you store and retrieve values on Patchworld's server so they persist across sessions, between worlds, and between players. Unlike the local Variable System, values posted online are kept on the backend and can be read back from any other Patchworld session.
Typical use cases:
Both blocks share three things:
| Scope | What gets prefixed | Use for |
|---|---|---|
| All Worlds | Nothing — global key. | Cross-world data shared by everyone (e.g. a "has visited Patchworld" flag). |
| All My Worlds | Your user id. | Data shared between worlds you own (e.g. an account-wide currency). |
| Only This World | This world's product id. | Data scoped to a single world (e.g. this world's leaderboard). |
Internally, the prefix is added automatically before the request: a key typed Score in the All My Worlds scope becomes something like <your_user_id>/Score on the server. To read it back, Fetch Var must be set to the same scope so it builds the same prefix.
The Value Type dropdown chooses what kind of value is sent or received:
Post Var reads a value from its dial / jolt input and stores it as a number. Fetch Var emits the loaded number on its Fetched Value jolt output.Post Var exposes a Tag input that accepts text-bearing blocks (e.g. Txt, Get Name, Join & Apply Text). Their text contents are concatenated and posted as a string. Fetch Var exposes a Tag input named Text Output — connect Txt blocks here and the fetched string is written into them when the request succeeds.In both cases, the boolean On Done / On Fail outputs let you chain logic (e.g. show a "Saved!" message, or retry on failure).
The keys themselves are just strings, so you can build them dynamically. By combining Players, Get Name Text and Join & Apply Text, you can produce per-player keys without any server-side concept of "user".
Pattern:
players (Local Player or All Players) ──► get_name ──┐
├──► join_apply_text ──► Post Var "<PlayerID>/Score"
"/Score" ──┘
Now every player writes to their own slot, and you can fetch any specific player's score from any world by reproducing the same key on a Fetch Var. The same trick lets you build:
<PlayerID>/HasVisitedMyWorld = 1 — to know if a given player has ever visited your world, even from another world.<PlayerID>/Inventory — text-mode keys are great for serializing a JSON-ish inventory blob.<PlayerID>/HighScore — combined with All My Worlds scope, you get a per-account high score that follows the player across all your worlds.To rewrite the Key field at runtime (instead of typing it manually), use a Join & Apply Text block targeting the Post Var / Fetch Var block: it can compose the key from a player id and a static suffix and apply it programmatically.
To keep the backend healthy and the experience snappy, both Post Var and Fetch Var enforce a soft cap of 10 operations per 10 seconds per block. If a request arrives over budget, it is delayed until the budget recovers (the On Done / Fetched Value / On Fail output fires whenever the request finally completes).
Practical consequences:
Score (e.g. additive) on the local player.Score.Post Var with key Score (or <PlayerID>/Score for per-player), scope Only This World.Fetch Var with the same key/scope.Set a Post Var key <PlayerID>/Achievements/FoundSecret = 1, scope All Worlds. From any other world you make, a Fetch Var on the same key will return 1 if the player has unlocked the achievement, or trigger On Fail if they haven't.
Use Value Type: Text on both Post Var and Fetch Var. Build the inventory string with Join & Apply Text and post it under <PlayerID>/Inventory. On world load, fetch it back into a Txt block and parse it however your gameplay needs.
| Need | Use |
|---|---|
| Tag/list blocks dynamically inside a single play session | Variable System |
| Synchronize values between players in the same session | Variable System with Broadcast Multiplayer |
| Persist values between sessions, players, or worlds | Online Variables (this page) |
It's common to layer the two: keep gameplay state in local variables for speed, and only post/fetch the snapshot you actually want to persist.