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

Can someone help with my Data Store problem?

Asked by 10 years ago
01local KEY_PREFIX = "userid_"
02local ds = game:GetService("DataStoreService"):GetDataStore("PlayerValuesDataStore")
03local profilesHolder = game.Workspace.Profiles
04Debounce = true
05 
06function saveToDataStore(plr)
07    if Debounce == true then
08        Debounce = false   
09    local key = KEY_PREFIX .. tostring(plr.userId)
10    local profile = profilesHolder[plr.Name]
11    local value = {}
12    for i,v in ipairs(profile:GetChildren()) do
13        value[v.Name] = v.Value
14        print(v.Name .. " = " .. tostring(v.Value))
15    end
View all 54 lines...

This is supposed to go through game.Workspace.Profiles and find all the values then save them and their values to a datastore. The problem is it is not working. It will print out values just fine when it saves, but I don't know if it's actually saving the data to it. Also, it will print "loaded" when I load, but not the loaded values because there is none to load or it is not fetching them properly. Can someone please help solve this issue?

Answer this question