Powerlang Docs
  • Welcome!
  • Beginner's Guide
    • Syntax
    • Directives
    • Environment
    • Special types
    • Functions
    • Tables
    • Loops
    • Conditions
    • Events
    • Libraries
    • Comments and Flags
  • Creating a Game
    • Project Introduction: Potato Rush
    • Creating the main game loop
    • Creating potatoes
    • Keeping track of score
  • Libraries
    • Special Types
      • BrickColor
      • CFrame
      • Color3
      • Instance
      • NumberRange
      • UDim2
      • Vector2
      • Vector3
    • Services
      • DataStore
      • Debris
      • Mouse
      • Pathfinding
      • PhysicsService
      • Players
      • Ray
      • TweenService
    • compiler
    • math
    • os
    • string
    • table
    • retrostudio
  • Advanced Information
    • Instance Functions
    • Global Functions
    • Multithreading
    • Compiler Library
Powered by GitBook
On this page
  1. Libraries
  2. Services

DataStore

The DataStore service allows you to load and save content that will last between game sessions. You can only save a maximum of 4MB of data to one key, and you can only perform 5 + (5 * players) operations per minute.

Function

Description

SaveVariable(Value: any, Key: string, Shared: bool?): Success: bool

Saves a variable in the datastore. Requires 2-3 arguments: Value (any type), Key (string), and an optional Shared (boolean). Returns a success status as a boolean (Success).

LoadVariable(Key: string, Shared: bool?): Success: bool, LoadedData: any

Loads a variable from the datastore. Requires 1-2 arguments: Key (string) and an optional Shared (boolean). Returns two outputs: Success (boolean) indicating if the load was successful and LoadedData (any type) with the loaded value.

SaveInstance(Model: Instance, Key: string, Shared: bool?): Success: bool

Saves an instance (model) in the datastore. Requires 2-3 arguments: Model (of type Instance), Key (string), and an optional Shared (boolean). Returns a success status as a boolean (Success).

LoadInstance(Key: string, Parent: Instance, Shared: bool?): Success: bool, LoadedModel: Instance

Loads an instance from the datastore. Requires 2-3 arguments: Key (string), Parent (Instance), and an optional Shared (boolean). Returns two outputs: Success (boolean) indicating if the load was successful and LoadedModel (Instance) representing the loaded instance/model.

PreviousServicesNextDebris

Last updated 7 months ago