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

How do i make the datastore save values that arent under "leaderstats"?

Asked by 6 years ago

I can't seem to get my script to work I don't want these values to show in leaderstats so I tried to save it from a different folder in the same location as leaderstats

local DSService = game:GetService("DataStoreService"):GetDataStore("Q14ER056")
game.Players.PlayerAdded:Connect(function(plr)
    local key = plr.Name
    local cmdsets = Instance.new("Folder", plr)
    local savevalue = Instance.new("BoolValue")
    cmdsets.Name = "Rankings"
    savevalue.Parent = cmdsets
    savevalue.Name = "IsAdmin"
    local getsaved = DSService:GetAsync(key)
    if getsaved then
        savevalue.Value = getsaved[1]
    else
        local NumbersToSave = {savevalue.Value}
        DSService:SetAsync(key, NumbersToSave)
    end
end)

game.Players.PlayerRemoving:Connect(function(plr)
    local key = plr.Name
    local ST = {plr.cmdsets.IsAdmin.Value}
    DSService:SetAsync(key, ST)
end)

1
same thing User#23365 30 — 6y
0
Datastores are not linked to the game in any way unlike older system that needed a player object. You are free to add /edit and remove keys at will (within the limitations of datastores) . User#5423 17 — 6y
0
There is no limitations to datastores but there is limitations of how much can be inside of one datastore. iiDev_Hunt3r 64 — 6y

Answer this question