Issue with DataStore2.combine when i go over 13 keys

Hi! I am working on getting some of the bones together for a game I am working on, but oddly once I hit the 14th key, I get this error:robloxError .
I have checked the spelling of all the arguments and variables. Although I am unsure of how to show it properly, much of the code is commented out as i’ve tried different things. I tried putting the combine command arguments all together and then broke down each one individually. It ALWAYS breaks at the energy key. I have tried commenting out other variables or removing energy, but it breaks in the same place. The full body of the code is posted below due to updating it for clarity.

Can you please format your script? It’s hard to tell what’s going on.

i tried using the “…” and for some reason it keeps freaking out on me and separating everything, not sure what’s going on :frowning:

1 Like

i have tried for the life of me to get rid of that inner scrolling box… it won’t go away. If you cant help i understand

I apologize for the poor formatting. I figured out the problem though! It was a missing semicolon after the datastore.combine on the last key :frowning: . Appreciate you attempting to look at it, i know it was an eyesore to try to debug!

1 Like

No worries! i’m glad that you’ve solved your problem!

ACK! The error popped again now that I uncommented the rest of the code! :frowning: If you can take a look i’d really appreciate it. I’ve spent an hour now just going over and over it looking for little formatting or spelling errors and i cant find anything :frowning:

local DataStore2 = require(game.ServerScriptService:WaitForChild(“MainModule”))
local player = game:GetService(“Players”)
local defaultValue = 100
local baseStat = 5
local baseMove = 16
local baseHP = 100

DataStore2.Combine("DATA","points");
DataStore2.Combine("DATA","strength");
DataStore2.Combine("DATA","movement");
DataStore2.Combine("DATA","stamina");
DataStore2.Combine("DATA","hitpoints");
DataStore2.Combine("DATA","currentHP");
DataStore2.Combine("DATA","dexterity");
DataStore2.Combine("DATA","wisdom");
DataStore2.Combine("DATA","intelligence");
DataStore2.Combine("DATA","damage");
DataStore2.Combine("DATA","meleeRange");
DataStore2.Combine("DATA","missileRange");
DataStore2.Combine("DATA","energy");
DataStore2.Combine("DATA","currentEnergy");
DataStore2.Combine("DATA","currentSkill");
DataStore2.Combine("DATA","damageType");
DataStore2.Combine("DATA","maxWeight");
DataStore2.Combine("DATA","currentWeight");
DataStore2.Combine("DATA","leftHandDelay");
DataStore2.Combine("DATA","rightHandDelay");
DataStore2.Combine("DATA","gold");
DataStore2.Combine("DATA","lumberJackSkill");
DataStore2.Combine("DATA","carpentrySkill");
DataStore2.Combine("DATA","lumberJackMastery");
DataStore2.Combine("DATA","carpentryMastery");
DataStore2.Combine("DATA","lumberJackBonus");
DataStore2.Combine("DATA","carpentryBonus");
DataStore2.Combine("DATA","lumberJackExperience");
DataStore2.Combine("DATA","carpentryExperience");
DataStore2.Combine("DATA","helper1Damage");
DataStore2.Combine("DATA","helper1Delay");
DataStore2.Combine("DATA","helper1DamageType");
DataStore2.Combine("DATA","headSlot");
DataStore2.Combine("DATA","chestSlot");
DataStore2.Combine("DATA","feetSlot");
DataStore2.Combine("DATA","leftHandSlot");
DataStore2.Combine("DATA","rightHandSlot");
DataStore2.Combine("DATA","helper1Slot");
DataStore2.Combine("DATA","cart1Slot");

game.Players.PlayerAdded:Connect(function(plr)             --Playeradded event Creating the DataStore Keys       
	local pointsDataStore = DataStore2("points",plr)    
	local strengthDataStore = DataStore2("strength",plr)  --PLAYER STATISTICS
	local moveDataStore = DataStore2("movement",plr)
	local staminaDataStore = DataStore2("stamina",plr)
	local hpDataStore = DataStore2("hitpoints", plr)
	local currentHpDataStore = DataStore2("currentHP",plr)
	local dexterityDataStore =  DataStore2("dexterity",plr)
	local wisdomDataStore = DataStore2("wisdom", plr)
	local intelligenceDataStore = DataStore2("intelligence", plr)
	local damageDataStore = DataStore2("damage",plr)
	local meleeRangeDataStore = DataStore2("meleeRange",plr)
	local missileRangeDataStore = DataStore2("missileRange",plr)
	local energyDataStore = DataStore2("energy", plr)
	local currentEnergyDataStore = DataStore2("currentEnergy",plr)
	local currentActiveSkillDataStore = DataStore2("currentSkill",plr)
	local damageTypeDataStore = DataStore2("damageType",plr)
	local maxWeightDataStore = DataStore2("maxWeight",plr)
	local currentWeightDataStore = DataStore2("currentWeight",plr)
	local leftHandDelayDataStore = DataStore2("leftHandDelay",plr)
	local rightHandDelayDataStore = DataStore2("rightHandDelay",plr)
	local goldDataStore = DataStore2("gold",plr)
	local lumberJackSkillDataStore = DataStore2("lumberJackSkill",plr)
	local carpentrySkillDataStore = DataStore2("carpentrySkill",plr)
	local lumberJackMasteryDataStore = DataStore2("lumberJackMastery",plr)
	local carpentryMasteryDataStore = DataStore2("carpentryMastery",plr)
	local lumberJackBonusDataStore = DataStore2("lumberJackBonus",plr)
	local carpentryBonusDataStore = DataStore2("carpentryBonus",plr)
	local lumberJackExperienceDataStore = DataStore2("lumberJackExperience",plr)
	local carpentryExperienceDataStore = DataStore2("carpentryExperience",plr)
	local helper1DamageDataStore = DataStore2("helper1Damage",plr)
	local helper1DelayDataStore = DataStore2("helper1Delay",plr)
	local helper1DamageTypeDataStore = DataStore2("helper1DamageType",plr)

										--the equipment slots to equip to
	local headSlotDataStore = DataStore2("headSlot",plr)
	local chestSlotDataStore = DataStore2("chestSlot",plr)
	local feetSlotDataStore = DataStore2("feetSlot", plr)
	local leftHandSlotDataStore = DataStore2("leftHandSlot",plr)
	local rightHandSlotDataStore = DataStore2("rightHandSlot",plr)
	local helper1SlotDataStore = DataStore2("helper1Slot",plr)
	local cart1SlotDataStore = DataStore2("cart1Slot",plr)
	
	
	local leaderstats = Instance.new("Folder", plr)           --Create the "leaderstats" folder
			leaderstats.Name = "leaderstats"
	
											--Anything that needs to be displayed in leaderstats goes here
		
	local points = Instance.new("IntValue",leaderstats)     
	      points.Name = "Points"
	
	
	
	
	
	--Stats that are created in the charData folder to be referenced by the player
	local charData = Instance.new("Folder", plr)                        --creating the characterdata folder in the player
	      charData.Name = plr.Name.."CharacterData"
										
	
		
		
	
	local strength = Instance.new("IntValue",charData)                 --creating a new IntValue that will hold the stat in the player object
	         strength.Name = "Strength"
	
	local movement = Instance.new("IntValue",charData) 
			 movement.Name = "Movement"
	
	local stamina = Instance.new("IntValue",charData)
			stamina.Name = "Stamina"
	
	local hp = Instance.new("IntValue",charData)
			hp.Name = "HitPoints"
	
	local currentHP = Instance.new("IntValue",charData)
			currentHP.Name = "CurrentHitPoints"
	
	local dexterity = Instance.new("IntValue",charData)
			dexterity.Name = "Dexterity"
	
	local wisdom = Instance.new("IntValue",charData)
			wisdom.Name = "Wisdom"
	
	local intelligence = Instance.new("IntValue",charData)
			intelligence.Name = "Intelligence"
	
	local damage = Instance.new("IntValue",charData)
			damage.Name = "Damage"
	
	local dexterity = Instance.new("IntValue",charData)
			dexterity.Name = "Dexterity"
	
	local  meleeRange = Instance.new("IntValue",charData)
			meleeRange.Name = "MeleeRange"
	
	local  missileRange = Instance.new("IntValue",charData)
			missileRange.Name = "MissileRange"
	
	local  energy = Instance.new("IntValue",charData)
			energy.Name = "Energy"
	
	local  currentEnergy = Instance.new("IntValue",charData)
			currentEnergy.Name = "CurrentEnergy"	
	
	local  currentActiveSkill = Instance.new("StringValue",charData)
			currentActiveSkill.Name = "CurrentActiveSkill"
	
	local  damageType = Instance.new("StringValue",charData)
			damageType.Name = "DamageType"
	
	local  maxWeight = Instance.new("IntValue",charData)
			maxWeight.Name = "MaxWeight"
	
	local  currentWeight = Instance.new("IntValue",charData)
			currentWeight.Name = "CurrentWeight"
	
	local  leftHandDelay = Instance.new("IntValue",charData)
			leftHandDelay.Name = "LeftHandDelay"
	
	local  rightHandDelay = Instance.new("IntValue",charData)
			rightHandDelay.Name = "RightHandDelay"
	
	local  gold = Instance.new("IntValue",charData)
			gold.Name = "Gold"
	
	local  carpentrySkill = Instance.new("IntValue",charData)
			carpentrySkill.Name = "CarpentrySkill"
	
	local  carpentryBonus = Instance.new("IntValue",charData)
			carpentryBonus.Name = "CarpentryBonus"
	
	local  carpentryMastery = Instance.new("IntValue",charData)
		    carpentryMastery.Name = "CarpentryMastery"
	
	local  carpentryExperience = Instance.new("IntValue",charData)	
			carpentryExperience.Name = "CarpentryExperience"
	
	local  lumberJackSkill = Instance.new("IntValue",charData)
			lumberJackSkill.Name = "LumberJackSkill"
	
	local  lumberJackBonus = Instance.new("IntValue",charData)
			lumberJackBonus.Name = "LumberJackBonus"
	
	local  lumberJackMastery = Instance.new("IntValue",charData)
			lumberJackMastery.Name = "LumberJackMastery"
	
	local  lumberJackExperience = Instance.new("IntValue",charData)
			lumberJackExperience.Name = "LumberJackExperience"
	
	local  helper1Damage = Instance.new("IntValue",charData)
			helper1Damage.Name = "Helper1Damage"
	
	local  helper1Delay = Instance.new("IntValue",charData)
			helper1Delay.Name = "Helper1Delay"
	
	local  helper1DamageType = Instance.new("IntValue",charData)
			helper1DamageType.Name = "Helper1DamageType"
	
	local headSlotEquip = Instance.new("StringValue",charData)
			headSlotEquip.Name = "HeadSlot"
	
	local chestSlotEquip = Instance.new("StringValue",charData)
			chestSlotEquip.Name = "ChestSlot"
	
	local feetSlotEquip = Instance.new("StringValue",charData)
			feetSlotEquip.Name = "FeetSlot"
	
	local leftHandSlotEquip = Instance.new("StringValue",charData)
			leftHandSlotEquip.Name = "LeftHandSlot"
	
	local rightHandSlotEquip = Instance.new("StringValue",charData)
			rightHandSlotEquip.Name = "RightHandSlot"
	
	local helper1SlotEquip = Instance.new("StringValue",charData)
			helper1SlotEquip.Name = "Helper1Slot"
	
	local cart1SlotEquip = Instance.new("StringValue",charData)
			cart1SlotEquip.Name = "Cart1Slot"

	
	
		
	
			
	
	
	local function pointsUpdate(
		updatedValue,
		updatedStrength,
		updatedMovement,
		updatedStamina,
		updatedHP,
		updatedCurrentHP,
		updatedDexterity,
		updatedWisdom,
		updatedIntelligence,
		updatedDamage,
		updatedMeleeRange,
		updatedMissileRange,
		updatedEnergy,
		updatedCurrentEnergy,
		updatedCurrentActiveSkill,
		updatedDamageType,
		updatedMaxWeight,
		updatedCurrentWeight,
		updatedLeftHandDelay,
		updatedRightHandDelay,
		updatedGold,
		updatedLumberJackSkill,
		updatedCarpentrySkill,
		updatedLumberJackMastery,
		updatedCarpentryMastery,
		updatedLumberJackBonus,
		updatedCarpentryBonus,
		updatedLumberJackExperience,
		updatedCarpentryExperience,
		updatedHelper1Damage,
		updatedHelper1Delay,
		updatedHelper1DamageType,
		updatedHeadSlotEquip,
		updatedChestSlotEquip,
		updatedFeetSlotEquip,
		updatedLeftHandSlotEquip,
		updatedRightHandSlotEquip,
		updatedHelper1SlotEquip,
		updatedCart1SlotEquip
								)
		
		
		--the function that is called whenever something changes a stat
		
		points.Value = pointsDataStore:Get(updatedValue)
		strength.Value = strengthDataStore:Get(updatedStrength)
		movement.Value = moveDataStore:Get(updatedMovement)
		stamina.Value = staminaDataStore:Get(updatedStamina)
		hp.Value = hpDataStore:Get(updatedHP)
		currentHP.Value = currentHpDataStore:Get(updatedCurrentHP)
		dexterity.Value = dexterityDataStore:Get(updatedDexterity)
		wisdom.Value = wisdomDataStore:Get(updatedWisdom)
		intelligence.Value = intelligenceDataStore:Get(updatedIntelligence)
		damage.Value = damageDataStore:Get(updatedDamage)
		meleeRange.Value = meleeRangeDataStore:Get(updatedMeleeRange)
		missileRange.Value = missileRangeDataStore:Get(updatedMissileRange)
		energy.Value = energyDataStore.Get(updatedEnergy)
		currentEnergy.Value = currentEnergyDataStore.Get(updatedCurrentEnergy)
		currentActiveSkill.Value = currentActiveSkillDataStore.Get(updatedCurrentActiveSkill)
		damageType.Value  = damageTypeDataStore.Get(updatedDamageType)
		maxWeight.Value = maxWeightDataStore.Get(updatedMaxWeight)
		currentWeight.Value = currentWeight.Get(updatedCurrentWeight)
		leftHandDelay.Value = leftHandDelayDataStore.Get(updatedLeftHandDelay)
		rightHandDelay.Value = rightHandDelayDataStore.Get(updatedRightHandDelay)
		gold.Value = goldDataStore.Get(updatedGold)
		lumberJackSkill.Value = lumberJackSkillDataStore.Get(updatedLumberJackSkill)
		carpentrySkill.Value = carpentrySkillDataStore.Get(updatedCarpentrySkill)
		lumberJackMastery.Value = lumberJackMasteryDataStore.Get(updatedLumberJackMastery)
		carpentryMastery.Value = carpentryMasteryDataStore.Get(updatedCarpentryMastery)
		lumberJackBonus.Value = lumberJackBonusDataStore.Get(updatedLumberJackBonus)
		carpentryBonus.Value = carpentryBonusDataStore.Get(updatedCarpentryBonus)
		lumberJackExperience.Value = lumberJackExperienceDataStore.Get(updatedLumberJackExperience)
		carpentryExperience.Value = carpentryExperienceDataStore.Get(updatedCarpentryExperience)
		helper1Damage.Value = helper1DamageTypeDataStore.Get(updatedHelper1Damage)
		helper1Delay.Value = helper1DelayDataStore.Get(updatedHelper1Delay)
		helper1DamageType.Value = helper1DamageTypeDataStore.Get(updatedHelper1DamageType)
		headSlotEquip.Value = headSlotDataStore.Get(updatedHeadSlotEquip)
		chestSlotEquip.Value = chestSlotDataStore.Get(updatedChestSlotEquip)
		feetSlotEquip.Value = feetSlotDataStore.Get(updatedFeetSlotEquip)
		leftHandSlotEquip.Value = leftHandSlotDataStore.Get(updatedLeftHandSlotEquip)
		rightHandSlotEquip.Value = rightHandSlotDataStore.Get(updatedRightHandSlotEquip)
		helper1SlotEquip.Value = helper1SlotDataStore.Get(updatedHelper1SlotEquip)
		cart1SlotEquip.Value = cart1SlotDataStore.Get(updatedCart1SlotEquip)
		
		
		
	end
	
	local replicatedStorage = game:GetService("ReplicatedStorage")             ---updating the client with the stat changes
	local player = game:GetService("Players")
	
	local function updateClientCurrency(amount)
	    replicatedStorage.Remotes.UpdateClientCurrency:FireClient(plr, amount)
	end
	pointsUpdate(defaultValue, baseStat)                               --calling the function with the stats being updated
	
	
	
	updateClientCurrency(pointsDataStore:Get(defaultValue))
	pointsDataStore:OnUpdate(updateClientCurrency)
	pointsDataStore:OnUpdate(pointsUpdate)                             --calling each of the datastores run the points update function when data changes
	strengthDataStore:OnUpdate(pointsUpdate)
end)




-- :Set() : Increment (500) 50

game.Workspace:WaitForChild("CrystalRed10").ClickDetector.MouseClick:Connect(function(player)
	---Player has clicked the red brick, increment their currency by 60
	
	local pointsDataStore = DataStore2("points",player)
	local strengthDataStore = DataStore2("strength",player)
	pointsDataStore:Increment(50,defaultValue)
	strengthDataStore:Increment(1,baseStat)
end)

Why not just do

DataStore2.Combine("Data", "Key1Name", "Key2Name", "Key3Name", "And Continue From Here" ) 

To format it to a code block use

--```

Edit: Ignore the –

I did do that, but it was giving me the same error, so I called each combine individually on each key. I just deleted the other way to improve readibility.

try using another script or module to combine new keys

Tips for the forum

  • You surround it with this;
--Post your entire script in these, you only need one set of ` and the lua tag for each script.
  • You’re able to edit each message/comment you create with the image feature, what you were doing was essentially spamming your thread which is against the DevForum Rules;

  • You’re using WAY too many DataStores; you can only send a certain amount of DataStore requests per minute; I believe the limit is 100 but i’m not sure. I would recommend filtering it a bit.

  • Please read all the rules in the DevForum; you broke a few of them here.


1 Like

I’m not sure what you mean when you say too many datastores, i was under the impression that using .combine saves them into 1 store and all values can be changed with just one request. Thanks for the heads up on the other rule clarification, I am just here for help and don’t want to appear to be spamming or breaking the rules.

1 Like

The whole Datastore thing is simply a pet peeve of mine; nothing to truly worry about.