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

DataStore not responding?

Asked by 10 years ago

How could i fix this? Please help please!

local DataStore = Game:GetService("DataStoreService"):GetDataStore("Storage")
Storage = {"KOS", "WOS", "Cash", "Rank", "XP"}

Game.Players.PlayerAdded:connect(function(Player)
repeat wait() until Player:FindFirstChild("leaderstats")
local Key = "user_"..Player.userId
wait(1)
for i=1, #Storage do
        if DataStore ~= nil then
        Storage[i].Value = DataStore:SetAsync(Storage[i].Name)
        DataStore:UpdateAsync(Key, function()   
        end)
        end
    end
end)

Game.Players.PlayerRemoving:connect(function(Player)
for i=1, #Storage do
        Storage[i].Value=DataStore:SetAsync(Player.Name..Storage[i].Name, Storage[i].Value)
        DataStore:UpdateAsync(Key, function()
        end)
    end
end)

DataStore:SetAsync(Player.Name..Storage[i].Name, Storage[i].Value) I added player.name to see if that might help.

How could i set a key value? (local Key = "user_"..Player.userId)) or use GetAsync? I really need this to work, please please help me!

0
Try changing Player:WaitForChild("leaderstats") to repeat wait() until Player:findFirstChild"leaderstats" Sometimes WaitForChild breaks like that wazap 100 — 10y
0
Can i get help on my DataStore problem though? peoplemove12 148 — 10y

Answer this question