ok so. i have quest system and on completing it it should remove quest, but it wont save after leaving.
questmodule.QuestRemove = function(plr,QuestName,OnRemoveFunc)
if QuestName == nil then
warn("Quest name cant be nil")
return
end
if plr == nil then
warn("Player cant be nil")
return
end
local QuestData = DataStore2("QuestDataNew4", plr)
print("Removed Quest")
QuestData:Set(nil)
if OnRemoveFunc ~= nil then
OnRemoveFunc()
end
end
local QuestData = DataStore2("QuestDataNew4", plr):Get() -- this gets the data from the datastore
QuestData = nil -- this sets the value to nil (assuming it is not a table)
DataStore2("QuestDataNew4", plr):Set(QuestData) -- this saves the QuestData data to the player's Datastore
I’m not too sure if this would work but please test it out.
Already did, it checks quest and if it exist it removing it. I used :Set(nil) and its settings to nil, like quest doesn’t exist anymore. But then i leaves it wont save it.
Looking at the documentation you should be able to set nil.
If you are unable to then just set it to “nil” or another value which you can compare as nil in your script.
In normal data stores, you’d save all your data into one giant player data table to minimize data loss/throttling. In DataStore2, this is a built in feature! Simply use DataStore2.Combine("DATA", "any", "keys", "here") , or call it multiple times ( DataStore2.Combine("DATA", "coins"); DataStore2.Combine("DATA", "guns") ).
These are called “combined data stores”, they save all your data into one big table but without the cost of ergonomics (you don’t have to get the entire data just to manipulate one part of it).
Can i get usage example? Or its like DataStore2.Combine(“PlayersInfo”,“coins”,“points”,“kills”) or its .Combine(“PlayersInfo”, coins,points,kills)