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

My datastore script is not working, not ingame and not in studio (with api on)?

Asked by
FBS_8 25
4 years ago
Edited 4 years ago

Script:

01local DataStoreService = game:GetService("DataStoreService")
02local DataStore = DataStoreService:GetDataStore("DrinkStats")
03 
04game.Players.PlayerAdded:Connect(function(Player)
05    local Leaderstats = Instance.new("Folder", Player)
06    Leaderstats.Name = "leaderstats"
07    local Drinks = Instance.new("IntValue", Leaderstats)
08    Drinks.Name = "Drinks"
09    Drinks.Value = 0
10 
11    local Data = DataStore:GetAsync(Player.UserId)
12    if Data then
13        Drinks.Value = Data
14    end
15end)
16 
17game.Players.PlayerRemoving:Connect(function(Player)
18    DataStore:SetAsync(Player.UserId, Player.leaderstats.Drinks.Value)
19    print("get saved noob")
20end)

1 answer

Log in to vote
0
Answered by
Komas19 34
4 years ago
Edited 4 years ago

Try this (script to put in ServerScriptService)

001    ["DoMessages?"] = true; --[[ <-- Reminder of saving/loading ]]
002    ["IsAnObby?"] = false; --[[ <-- Respawns the character to fix loading ]]
003    saveType = {
004        ["Normal?"] = true; --[[ <-- Set to false if other ]]
005        ["SavingList?"] = { --[[ <-- Specific wanted admins ]]
006            ["DoIt?"] = false;
007            theList = {
008                "Name1";
009                "Name2";
010                "Name3"
011            }
012        };
013        ["BestFriends?"] = false; --[[ <-- Best friends of your's only. ]]
014        ["Friends?"] = false; --[[ <-- Friends of your's only. ]]
015        ["OwnerOnly?"] = false; --[[ <-- Only you have saving stats ]]
View all 140 lines...

If this won't work make sure that api is ON

Ad

Answer this question