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

My Data Store will not work in FE?

Asked by
xEiffel 280 Moderation Voter
6 years ago

I can't quite figure out this problem with my DataStore, It's on Filtering Enabled and a server-side script in workspace. a Local Script is changing the values in a StarterGui Frame, any help would be great!

local DSService_Q = game:GetService("DataStoreService"):GetDataStore("Quest")

game.Players.PlayerAdded:Connect(function(player)
    local UniqueKey = "id-"..player.userId
    local Holder = Instance.new("Folder")
    Holder.Name = "Data"
    Holder.Parent = player
    local SpinVal = Instance.new("NumberValue")
    SpinVal.Value = 0
    SpinVal.Name = "SpinnerCalculations"
    SpinVal.Parent = Holder
    local CurrentPlate = Instance.new("NumberValue")
    CurrentPlate.Value = 1
    CurrentPlate.Name = "CurrentTile"
    CurrentPlate.Parent = Holder
    local Number = Instance.new("NumberValue")
    Number.Value = 0
    Number.Name = "NumberPrototype"
    Number.Parent = Holder
    local Quests = Instance.new("Folder")
    Quests.Name = "Quests"
    Quests.Parent = Holder
    local Q1 = Instance.new("StringValue")
    Q1.Name = "Quest1"
    --Q1.Value = --data
    Q1.Parent = Quests
    local QP = Instance.new("IntValue")
    QP.Name = "QuestProgress"
    QP.Parent = Q1
    --//Get Async
    local GetData = DSService_Q:GetAsync(UniqueKey)
    if GetData then
        Q1.Value = GetData[1]
        QP.Value = GetData[2]
    else
        local NumbersForSaving = {Q1.Value, QP.Value}
        DSService_Q:SetAsync(UniqueKey, NumbersForSaving)
    end
end)

game.Players.PlayerRemoving:Connect(function(player)
    local UniqueKey = "id-"..player.userId
    local SaveTable = {player.Data.Quests.Quest1.Value, player.Data.Quests.Quest1.QuestProgress.Value}
    DSService_Q:SetAsync(UniqueKey, SaveTable)
end)
0
changing values in a localscript doesnt work, you can create a remoteevent and call it in a localscript and change the values there saveourwolves 2 — 6y

Answer this question