How to Save Player Data Between Worlds
Keep a player coin count when they move between worlds in the same game, and make it survive leaving and rejoining too.
Introduction
When a player walks through a portal into another world, everything they collected can vanish. The coin count starts again at zero, and the progress they made in the first world is gone. That is how it works by default, and it makes any game with more than one world feel broken. The fix is a Player Variable . You create it once, and it lives in every world of the same game. A coin script adds 1 to it each time a player picks up a coin, a trigger moves the player to the next world, and the count travels with them. This tutorial builds exactly that, with a coin counter that works in World 1 and World 2, and a toast that shows the current count on screen. Build a Save System, Persist player progress so it survives leaving the game. This tutorial is dummy data for testing the Tutorials hierarchy. Edit or remove it from the Admin Dashboard at any time.
What You Need
A game project with two worlds, World 1 and World 2. One coin in each world. One Trigger in each world, to teleport the player to the other world. A Player Variable called Coin, with Cloud Variable turned on.
Steps
1. Choose World or Game. Open your game project. At the top you see two cards: WORLD and GAME. Tap WORLD to build worlds. World and Game cards at the top of a game project step-01-choose-world-game.webp Open your game project and tap WORLD to build worlds. caption 2. Create a new world. Tap Create to make a new world, or Import if you already have one. A new empty world appears in the list. World list with Import and Create buttons step-02-create-world.webp Tap Create to make a new world, or Import one you already have. World list with a new empty world step-02b-new-world-appears.webp A new empty world appears in the list. 3. Open World 1 in the editor. Tap the world to open it. The top toolbar has Menu, Group, Fast, Setting, Analysis, Data, Display, and Tool. Empty world in the editor with the top toolbar step-03-open-world1.webp Tap the world to open it in the editor. 4. Choose the Number type. Open Data, go to the Player tab, and tap Add Variable. In the type picker, choose Number, because a coin count is a number. Choose Variable Type dialog with the Number type highlighted step-04-choose-number-type.webp A coin count is a number, so pick the Number type. 5. Create the Coin variable. Name it Coin and leave the value at 0. Turn on Cloud Variable before you tap Confirm. Cloud Variable is what lets the count survive when the player leaves and rejoins the game. Create Variable dialog with the Cloud Variable checkbox turned on step-05-create-coin-variable.webp Turn on Cloud Variable if you want the count to survive leaving the game. 6. Check the variable. Coin is now in the Player tab. You only create it once. A Player Variable appears in every world of the same game on its own. Add Variable panel showing the Coin variable in the Player tab step-06-check-variable.webp Coin is already in the Player tab. There is nothing to create twice. 7. Add a Trigger. Open Device, go to BASIC, and place a Trigger. This trigger will teleport the player to World 2 later. BASIC device panel with the Trigger device step-07-add-trigger.webp The Trigger will teleport the player to World 2 later. 8. Add a Coin. Open Device, go to OTHERS, and place a Coin on the ground in World 1, near the trigger, where the player will walk into it. OTHERS device panel with the Coin device step-08-add-coin.webp A coin on the ground in World 1, near the trigger. 9. Set the coin to refresh. Select the coin and open its Properties. Set Refresh Time to 3.0. The coin comes back 3 seconds after a player picks it up. Coin properties panel with Refresh Time set to 3.0 step-09-refresh-time.webp Refresh Time 3.0 brings the coin back 3 seconds after each pickup. 10. Set the Coin variable when the coin is picked up. Open the coin script. Under When trigger is entered by, add a Set command. Set the target to the Coin Player Variable. Coin script with Set commands under When trigger is entered by step-10-set-coin-script.webp The Set command targets the Coin Player Variable. 11. Add 1 to the count. Set the value to the Coin Player Variable, choose Add, and put 1. Each coin a player picks up adds 1 to the count. Set command adding 1 to the Coin Player Variable step-11-add-one.webp Each coin picked up adds 1 to the count. 12. Add the teleport script to the trigger. Select the trigger and open its script. Under When trigger is entered by, add an Execute command. Trigger properties panel with the Scripts section step-12-teleport-script.webp Open the trigger script under When trigger is entered by. Trigger script with an Execute command step-12b-execute-teleport.webp Add an Execute command to the trigger script. 13. Pick World 2 as the target. In the Execute command, choose Character.Controlling Player.Player.Teleport To World, then tap the plus button on Target Map and pick World 2. Tap OK. The target map now shows World 2. Execute Teleport To World command with the Target Map plus button step-13-teleport-target.webp Tap the plus button on Target Map to choose the destination world. World picker with the second world selected step-13b-select-world2.webp Pick World 2 as the target, then tap OK. Execute command with the Target Map filled step-13c-target-set.webp Target Map tells the trigger which world to send the player to. 14. Save World 1 and exit. Give the world a name, pick a cover, and tap Save and exit. Name it WORLD 1, so you can tell it apart from World 2 later. World info panel with the name WORLD 1 and the Save and exit button step-14-save-world1.webp Name the world WORLD 1, pick a cover, and save. 15. Enter World 2. Back in the world list, open World 2. It is the other world in the same game. World list with WORLD 1 and the second world step-15-enter-world2.webp Open World 2 from the world list. 16. Add the same coin in World 2. Put a coin in World 2, near the trigger, and give it the same script as in World 1: when the player picks it up, add 1 to the Coin variable. Do not create a second Coin variable. The one from World 1 is already here. The same coin, with the same script, in World 2. 17. Show the count in a toast. In the coin script, add an Execute command, then UI, Current UI, UI Base, Show Toast. Put the Coin variable in the toast, so the player sees the count on screen. Show Toast displays the current Coin value on screen. 18. Add a trigger back to World 1. Place a trigger in World 2. In its script, pick WORLD 1 as the target world, so the player can travel back. World picker with WORLD 1 selected step-18-trigger-back-world1.webp Pick WORLD 1 as the target, so the player can travel back. 19. Save World 2. Save and exit, and name this world WORLD 2. Give each world a different name, so they are easy to tell apart and remember. World info panel with the name WORLD 2 and the Save and exit button step-19-save-world2.webp Save each world under a different name, so they are easy to tell apart. 20. Test in Play mode, not Edit mode. Press Play. Pick up coins in World 1, walk through the trigger, and pick up more in World 2. The count carries over. It never resets.
Tip
Turn on Cloud Variable when you create the variable. Without it, the count carries between worlds inside one session, but it is gone when the player leaves and rejoins. Test in Play mode. Edit mode does not transfer data between worlds, so a test in Edit mode will look broken even when the setup is right. Create the variable once. A Player Variable appears in every world of the same game on its own, so never create a second Coin variable in World 2. Use a short Refresh Time while you test. Refresh Time 0.5 lets one coin be collected again and again, so you can check the count without placing a row of coins.