LuckyDataStore - An Easy to Use Saving Module with Session Locking and Auto-Saving

I totally agree with this too, when I first wanted to write this I was thinking about using firebase databases for easier saving because HTTP service allows 500 requests per minute. Then I realized there are also limits for firebase too which were daily. I still wanted to write my own module and I am still working on to improve it.

Sorry to be of bother again but Iā€™m here to report another issue. After I started using the updated model and the script youā€™ve sent me before, there seems to be multiple errors. Every now and then in private servers the data will save and load and such, but sometimes itā€™ll error.

I get this in the output:
h5

It never did this before your recent update got pushed.

1 Like

Well, thatā€™s kind of weird. Zeph. really needs to figure out whatā€™s up. Iā€™ma check on the module on why itā€™s happening.

1 Like

I am aware of that issue, I updated it once more and it should not do that. I am still working on it to check for bugs but I am also working IRL and I generally donā€™t have much time. Also as I said earlier please require it with id so you always keep up to date.

1 Like

Data hasnā€™t been saving correctly. I only get an error when trying to manually save and donā€™t get any overall. The data will load but it just wonā€™t save anything to the stats and when I rejoin, itā€™s back to itā€™s data I had before leaving.

EDIT: Iā€™m confirming the data wonā€™t save at all, not just manually saving.

this is a nice group but what do we do here that is my question i,m not try to be rude ok just asking

All issues fixed, I couldnā€™t update the old model so I created a new model and updated the original post. Please take the new module there.

Please donā€™t send off-topic stuff, but here in this post, @Helyras has made a module for Data saving. And you can use it / reply about bugs and glitches and other stuff. Hope you get what I mean!

1 Like

I was using the new model. I just re-required the new model again and itā€™s still not saving data. Iā€™ve also switched to using the script itself in game rather than requiring the model and itā€™s still having the same issue. Iā€™m using the script you sent me above so the format is 100% right. I can confirm this is happening every since you included the update to fix the Callback error around 17 days ago. The error got fixed but I think thatā€™s when data quit saving.

Use this please.
Edit: Tested in the studio just a second ago and works.

local LuckyDataStore = require(7239753643)
-- sometimes requiring with id doesn't works maybe get the module manually

local default = {
	BlueprintsFilled = 0,
	HasDragPower = "False",
	HasBaseLights = "False",
	Slot1Name = "UNNAMED",
	Slot2Name = "UNNAMED",
	Slot3Name = "UNNAMED",
	Slot4Name = "UNNAMED",
	Slot5Name = "UNNAMED",
	FavoriteBlueprints = {},
}

game.Players.PlayerAdded:Connect(function(player)

	local PlayerDataFolder = Instance.new("Folder")
	PlayerDataFolder.Name = "PlayerData"

	local BlueprintsFilled = Instance.new("IntValue",PlayerDataFolder)
	BlueprintsFilled.Name = "BlueprintsFilled"

	local HasDragPower = Instance.new("IntValue",PlayerDataFolder)
	HasDragPower.Name = "HasDragPower"

	local HasBaseLights = Instance.new("IntValue",PlayerDataFolder)
	HasBaseLights.Name = "HasBaseLights"

	local Slot1Name = Instance.new("StringValue",PlayerDataFolder)
	Slot1Name.Name = "Slot1Name"

	local Slot2Name = Instance.new("StringValue",PlayerDataFolder)
	Slot2Name.Name = "Slot2Name"

	local Slot3Name = Instance.new("StringValue",PlayerDataFolder)
	Slot3Name.Name = "Slot3Name"

	local Slot4Name = Instance.new("StringValue",PlayerDataFolder)
	Slot4Name.Name = "Slot4Name"

	local Slot5Name = Instance.new("StringValue",PlayerDataFolder)
	Slot5Name.Name = "Slot5Name"

	local playerData = LuckyDataStore.CreateData(player,"PlayerData",default)
	playerData:Combine(BlueprintsFilled,HasDragPower,Slot1Name,Slot2Name,Slot3Name,Slot4Name,Slot5Name)

	PlayerDataFolder.Parent = player

end)
1 Like

Okay, so I havenā€™t been on an update with this module so. Anyways, my main question.

Will you let us handle some parts of the module? So for example, if loading the data is success, we do something like

YourDataStore.SuccessfullyLoaded:Connect(function()
    -- Stuff
end

Or

YourDataStore.ErrorOnLoadingData:Connect(function()
    -- Stuff
end

Is it already possible? If not just a little bit of an idea for the module!

It is not possible currently but that is a great idea! Surely going to add them.

1 Like

Iā€™m having reason to believe it only saves when a value is changed in a public server and the player only joins back on the public server. Vip servers wonā€™t save when a new server is created. Thereā€™s no reason for it not to save. Also you sent me this but a value is missing from the combine function and I changed the has values to true or false/bool values.

Isnā€™t Datastore2 better and easier to use than this, also the source code looks similar to the one from this tutorial.

I have talked with that guy personally too, session lock is implemented from that post and the topic owner knows that.

1 Like

Okay, I will look what is wrong with it but my tests was all successfully working. Also, what do you mean a value is missing from combine function?

Hereā€™s the new and updated code that doesnā€™t seem to save.

EDIT: I think it truly is only VIP servers that donā€™t save. Public servers 100% save.

-------------------- [[ VARIABLES ]] --------------------

local Module = require(script.Parent.Datastore)

-------------------- [[ SCRIPTING ]] --------------------

local Default = {
	BlueprintsFilled = 0,
	CompletedLavaQuest = false,
	BaseWaypointToggle = false,
	BlueprintLightToggle = false,
	Slot1Name = "UNNAMED",
	Slot2Name = "UNNAMED",
	Slot3Name = "UNNAMED",
	Slot4Name = "UNNAMED",
	Slot5Name = "UNNAMED",
	FavoriteBlueprints = {},
}

game.Players.PlayerAdded:Connect(function(Player)

	local PlayerDataFolder = Instance.new("Folder")
	PlayerDataFolder.Name = "PlayerData"

	local BlueprintsFilled = Instance.new("IntValue",PlayerDataFolder)
	BlueprintsFilled.Name = "BlueprintsFilled"
	
	local CompletedLavaQuest = Instance.new("BoolValue",PlayerDataFolder)
	CompletedLavaQuest.Name = "CompletedLavaQuest"
	
	local BaseWaypointToggle = Instance.new("BoolValue", PlayerDataFolder)
	BaseWaypointToggle.Name = "BaseWaypointToggle"
	
	local BlueprintLightToggle = Instance.new("BoolValue", PlayerDataFolder)
	BlueprintLightToggle.Name = "BlueprintLightToggle"
	
	local Slot1Name = Instance.new("StringValue",PlayerDataFolder)
	Slot1Name.Name = "Slot1Name"

	local Slot2Name = Instance.new("StringValue",PlayerDataFolder)
	Slot2Name.Name = "Slot2Name"

	local Slot3Name = Instance.new("StringValue",PlayerDataFolder)
	Slot3Name.Name = "Slot3Name"

	local Slot4Name = Instance.new("StringValue",PlayerDataFolder)
	Slot4Name.Name = "Slot4Name"

	local Slot5Name = Instance.new("StringValue",PlayerDataFolder)
	Slot5Name.Name = "Slot5Name"

	local PlayerData = Module.CreateData(Player,"StatsSave", Default)

	PlayerData:Combine(BlueprintsFilled, CompletedLavaQuest, BaseWaypointToggle, BlueprintLightToggle, Slot1Name, Slot2Name, Slot3Name, Slot4Name, Slot5Name)

	PlayerDataFolder.Parent = Player
end)

Iā€™m confirming rn.

Data will NOT save in VIP servers
Data WILL save in public servers

Public:
confirmation

Private:

I have updated the module, can you try again? Also added 2 events to give you guys more control over the module.

Still not saving in Private/VIP Servers. I tried the manual save before and got an error with argument 3 needing to be a table so I just deleted the manual save in the script.