Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

DataStore1 has been broken for me for a long time in roblox studio?

Asked by
edwisc 1
3 years ago

My script:

local DSS = game:GetService("DataStoreService")

local PlayerCash = DSS:GetDataStore("Cash_0.0.1")

local Player = game.Players.LocalPlayer

local Folder = Instance.new("Folder",Player)
Folder.Name = "Data"
local Cash = Instance.new("IntValue",Folder)
Cash.Name = "Cash"
Cash.Value = PlayerCash:GetAsync(Player.UserId) or 0

while wait (100) do
    game.Players.PlayerRemoving:connect(function(Player)
        PlayerCash:SetAsync(Player.UserId, Cash.Value)
    end)

    while wait(100) do
        print("Data Saved")
        PlayerCash:SetAsync(Player.userId, Cash.Value)
    end
end

API Services are on!

Answer this question