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

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.

Are you sure that you are getting the right module? Because model has been changed and I have already made tests in private servers and it was working all fine.

Yeah, I’m using the one that got updated the 5th of this month. I don’t get any errors at all, it just doesn’t seem to save in private servers.

Okay, please send the code you are using and check that if the module you are using matches the source code in the post. As I stated before I tested with the code you sent just above this messages and it was all working fine. Old model is replaced by a new one, for some reason when I publish an update it wasn’t updating the model.

local StoreData = DataStore.CreateData(Player, "ExtraData")
local PlayerData = StoreData.Data
local Notifications = PlayerData.Notifications

Everything is already created in another module using a default table. Nothing errors in it. It’s when I’m trying to get the current data. I couldn’t find anything else in the API that could help.

1 Like

There is another function for getting existing data, FindData. I forgot to update the API my bad.

Hey I’m coming back to this because I really want it fixed. Have you found out the way to fix private server data not saving? Public servers will save data and such but private servers won’t save when leaving them and coming back to a private or public.
My Code:

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

local Module = require(script.Parent.Parent.Modules.Datastore)

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

local Default = {
	Slot1Name = "UNNAMED",
	Slot2Name = "UNNAMED",
	Slot3Name = "UNNAMED",
	Slot4Name = "UNNAMED",
	Slot5Name = "UNNAMED",
	Notifications = {"Notification From Game Developer: Welcome!"},
}

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

	local PlayerDataFolder = Instance.new("Folder")
	PlayerDataFolder.Name = "PlayerData"
	
	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, "ExtraData", Default)

	PlayerData:Combine(Slot1Name, Slot2Name, Slot3Name, Slot4Name, Slot5Name)

	PlayerDataFolder.Parent = Player
end)
1 Like

This is old but did this get fixed?

Nope, it’s still an issue. I think the creator has left this project.

1 Like