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

Saving other values than leaderstats?

Asked by 4 years ago
Edited 4 years ago

Should I be able to save values other than leaderstats? I have a boolean directly inside the player in Players. I also have leaderstats. My leaderstats save correctly, however my boolean doesn't save. I am using the same method on both, and it never gives off any errors. (I am using GetAsync and SetAsync)

01local datastore = game:GetService("DataStoreService")
02local ds = datastore:GetDataStore("item")
03 
04game.Players.PlayerAdded:Connect(function(plr)
05 
06    local item = Instance.new("BoolValue",plr)
07    item.Name = "Sparkles"
08 
09    local d1
10 
11    local y1 = pcall(function()
12        d1 = ds:GetAsync(plr.UserId.."Sparkles-")
13    end)
14 
15    if  y1 then
View all 23 lines...
0
You don't have to use leaderstats to save. You can use any folder for your values User#34929 0 — 4y
0
Please post your code so we can fix it [ https://scriptinghelpers.org/help/how-post-good-questions-answers ] Leamir 3138 — 4y
0
Okay, I uploaded the code :) Amanda314159 291 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Yeah, you can definitely save a bool value in a player. You can add it as another parameter in SetAsync.

Example:

1DataStore:SetAsync(player.UserId, true)
0
Can also save tables/dictionaries Leamir 3138 — 4y
Ad

Answer this question