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

my datastore is still not working with filtering enabled. can any of you guys help me out here?

Asked by 6 years ago

I also wanted to let you that that FE is on and the script is in the workspace

01local DSService = game:GetService("DataStoreService"):GetDataStore("Currency")
02 
03game:GetService("Players").PlayerAdded:connect(function(plr)
04    local leader = Instance.new("Folder",plr)
05    leader.Name = "leaderstats"
06 
07    local Credits = Instance.new("IntValue",leader)
08    Credits.Name = "Credits"
09 
10    local Diamonds = Instance.new("IntValue",leader)
11    Diamonds.Name = "Diamonds"
12 
13    local savedData = DSService:GetAsync(plr.UserId.."-Currency")
14 
15    if savedData then
View all 33 lines...
0
What’s the issue? I don’t have a computer to find errors at the moment. T1mes 230 — 6y
0
How are you changing the values? arshad145 392 — 6y
0
I already tested your script , it works fine... workspace > Script ( Above content ) Press F9 > Server log then game.Players.NAMEHERE.leaderstats.Diamonds.Value = 9999. arshad145 392 — 6y

1 answer

Log in to vote
0
Answered by
hudzell 238 Moderation Voter
6 years ago

The server is shutting down before the data saves. To prevent this, you need to add game:BindToClose() to the script. Try this instead

01local DSService = game:GetService("DataStoreService"):GetDataStore("Currency")
02local Saving = 0
03 
04game:BindToClose(function()
05    repeat wait() until Saving <= 0
06end)
07 
08game:GetService("Players").PlayerAdded:connect(function(plr)
09    local leader = Instance.new("Folder",plr)
10    leader.Name = "leaderstats"
11 
12        local Credits = Instance.new("IntValue",leader)
13        Credits.Name = "Credits"
14 
15        local Diamonds = Instance.new("IntValue",leader)
View all 40 lines...
0
thanks jakebball2014 84 — 6y
0
it still only work's in studio jakebball2014 84 — 6y
0
even though the leaderboard shows that the value changed in roblox jakebball2014 84 — 6y
Ad

Answer this question