How to create a datastore?

Hello there! i wanna know how i could datastore these values:
idk how to do this could someone explain?

When the player leaves, make a datastore for those values. If you don’t know how to create datastores, check out this tutorial:

To make a datastore, first go to the game settings thing and enable access to api in security tab of game settings

local DSS = game:GetService("DataStoreService")
local ds = DSS:GetDataStore("Datastore Name Here")

they work like dictionaries, requiring a key (such as player id) and a value (money, score, etc)
use :GetAsync() and :SetAsync() to retrieve and change the values, but since these can occasionally fail due to internet issues or whatnot, use a pcall

local success, errorMsg = pcall(function()
    ds:SetAsync(key, value)