You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Use datastore2 to save a table of quest information, which is initialized to a nil value -
What is the issue? Include screenshots / videos if possible!
In two places of a universe, the datastore returns two different values, one is nil and the other is a table of seemingly random quest data which never occurred. This resulted in new players loading into the game with some quests already completed. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Using Developer Hub, DataStore2 documentation, datastore documentation, etc.
Let me know if you require more code.
-- QUESTS
local questUpdateRemote = ReplicatedStorage.QuestUpdate
local function questsUpdate(updatedValue)
questsTable = questsDataStore:Get(updatedValue)
quests:ClearAllChildren()
if questsTable ~= nil then
Module.ConvertDictionaryToInstances(questsTable, quests)
end
questUpdateRemote:FireClient(plr, "updateQuestList")
end
questsDataStore:OnUpdate(questsUpdate)
local function initialQuestsUpdate(updatedValue)
questsTable = questsDataStore:Get(updatedValue)
quests:ClearAllChildren()
if questsTable ~= nil then
Module.ConvertDictionaryToInstances(questsTable, quests)
questUpdateRemote:FireClient(plr, "initialQuestsUpdate")
end
questUpdateRemote:FireClient(plr, "updateQuestList")
end
initialQuestsUpdate(questsTable)