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

There’s an end at the bottom for player added btw, it’s just not on the picture.

Interesting, I am not on my computer right now, I will look what is the issue when I get back to my computer and update this reply. Can you try parenting the folder after combine?

Yeah I’ll try parenting after the combine, give me one second

Still the same issues:

The issue is still on the combine line

Okay, I will look whats wrong, and are you using the latest version?

Yeah I’m running the latest version. It’s happened on older versions as well and on other games by me. I’ve tried workarounds to fix it but nothing seems to work. Thank you

Okay, thanks for reporting it. I am sorry about this error.

Hey, no problem. I should have reported it sooner but I thought it might have been on my end.

I think I know the issue, I saw that you have a HasBaseLights value in your table but not as a instance. Can you try making a HasBaseLights instance value or removing it from default table?

Edit: Also here is the code I have tested. I will go more deep on this error.

local LuckyDataStore = require(script.MainModule)

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,"StatsSave1",default)
	playerData:Combine(BlueprintsFilled,HasDragPower,Slot1Name,Slot2Name,Slot3Name,Slot4Name,Slot5Name)

	PlayerDataFolder.Parent = player

end)

Edit2: I have tried to recreate the error you got with using the same script but I couldn’t make it, instead of sending screenshot can you put the code here?

Here’s the whole script:

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

local Module = require(script.Parent.Datastore)

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

local DefaultPlayerStats = {

	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", Player)
	PlayerDataFolder.Name = "PlayerData"

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

	local HasDragPower = Instance.new("StringValue", PlayerDataFolder)
	HasDragPower.Name = "HasDragPower"
	
	local HasBaseLights = Instance.new("StringValue", 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 = Module.CreateData(Player, "StatsSave" , DefaultPlayerStats)
	PlayerData:Combine(BlueprintsFilled, HasDragPower, Slot1Name, Slot2Name, Slot3Name, Slot4Name, Slot5Name)
		
	--awardBadge(Player, 2124664630)

end)

Yes, I am getting the same issue with your code, can you use the code i put before this reply? That was working fine.

There is 2 possibility, there is something I can’t see that is wrong in your code or I forgot to publish the newest version :expressionless:

But what about the HasDragPower and HasBaseLights being int values rather than srings? Is the reason it wasn’t working because they were strings rather than ints?

Because the defaults you send me are string values in the table but the instances are ints

Oh I didn’t noticed that you used them as strings, I’m going to quickly try with string.

Well if they don’t work as strings then that could be the issue, but I’m also fine with working with them as int values and just checking true or false as 0 or 1 lol

I tested them with strings and there is no error. As I said earlier I think there is something I couldn’t see in your code that is wrong or I forgot to publish the newest version. (Published it just a second ago.)

local LuckyDataStore = require(script.Parent.MainModule)

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,"StatsSave2",default)
	playerData:Combine(BlueprintsFilled,HasDragPower,Slot1Name,Slot2Name,Slot3Name,Slot4Name,Slot5Name)

	PlayerDataFolder.Parent = player

end)

I’ve actually just switched the old model with the new one and it’s instantly fixed it. Maybe that’s what it was.

1 Like

Yeah either I forgot to publish it or you forgot to update, If you want to always keep up to date you can require the module by it is ID.

local LuckyDataStore = require(6989257174)

Either way, thank you a lot for helping me out. It’s a great starting module and I love using it for basic stats.

1 Like

No problem, thank you for your nice reply!

I totally agree, I see so many data store modules out these days that all do the same thing, but none of them really accomplish anything that hasn’t been done before. Saying that this module is “basic” and “easy to use” is cool and all, but modules like Datastore2 are meant to be easy to use and Profile service is very powerful. This module is not powerful as, like what has been said, there are a lot of edge cases that haven’t been covered.

2 Likes