DataStore2 errors when using multiple datastores in 1 script

Hello,

I am a new DataStore2 (by @Kampfkarren) user, and I am trying to migrate “old” datastores to DataStore2 in my game.
I have a trouble doing that, it’s kind of different to explain. I am trying to use 2 datastores in my XP system script: everything works great, until I try to use :Increment() with 1 datastore:


The script looks like that:

XP system script
local DataStore2 = require(game:GetService("ServerScriptService").DataStore2)

DataStore2.Combine("PurpleCoinData", "PCs")
DataStore2.Combine("plrxp", "Level", "Exp", "Reqexp", "BPBought")

game:GetService("Players").PlayerAdded:Connect(function(Player)
	local PCs = DataStore2("PCs", Player)
	PCs:SetBackup(5)
	
	local lvlStr = DataStore2("Level", Player)
	lvlStr:SetBackup(5)
	
	local expStr = DataStore2("Exp", Player)
	expStr:SetBackup(5)
	
	local reqStr = DataStore2("Reqexp", Player)
	reqStr:SetBackup(5)
	
	local bpbStr = DataStore2("BPBought", Player)
	bpbStr:SetBackup(5)
	
	local leaderstats = Player

	local Level = Instance.new("NumberValue",leaderstats)
	Level.Name = "Level"
	Level.Value = lvlStr:Get(1)


	local Exp = Instance.new("NumberValue",leaderstats)
	Exp.Name = "Exp"
	Exp.Value = expStr:Get(0)

	
	local RequiredExp = Instance.new("NumberValue",Player)
	RequiredExp.Name = "RequiredExp"
	RequiredExp.Value = reqStr:Get(Level.Value*10)


	local BattlepassBought = Instance.new("BoolValue", Player)
	BattlepassBought.Name = "IsBPBought"	
	BattlepassBought.Value = bpbStr:Get(false)
	
	Exp.Changed:Connect(function(Changed)
		if Exp.Value >= RequiredExp.Value then
			if Level.Value < 50 then
				local finnumb = RequiredExp.Value
				finnumb = -finnumb
			
				expStr:Increment(finnumb)				
				lvlStr:Increment(1)
			
				local incrnumb = Level.Value * 10 - RequiredExp.Value 
				reqStr:Increment(incrnumb)
			
				PCs:Increment(300)
			else 
				if Level.Value == 50 then
					expStr:Increment(-RequiredExp.Value)
					reqStr:Increment(Level.Value*10 - RequiredExp.Value)
				end
			end
		end
	end)
	
	lvlStr:OnUpdate(function(value)
		Level.Value = value
	end)

	expStr:OnUpdate(function(value)
		Exp.Value = value
	end)

	reqStr:OnUpdate(function(value)
		RequiredExp.Value = value
	end)

	bpbStr:OnUpdate(function(value)
		BattlepassBought.Value = value
	end)
end)

Please note that “PCs” value was set in another script:

Leaderstats "PCs" value script
local DataStore2 = require(game:GetService("ServerScriptService").DataStore2)

DataStore2.Combine("PurpleCoinData", "PCs")

local bs = game:GetService("BadgeService")


game:GetService("Players").PlayerAdded:Connect(function(plr)
	local ds = DataStore2("PurpleCoinData", plr)
	ds:SetBackup(5)
	
	local pc = Instance.new("IntValue")
	pc.Name = "PurpleCoins"
	pc.Parent = plr
	pc.Value = ds:Get(0)
	
	ds:OnUpdate(function(new)
		pc.Value = new
	end)
end)

I am confused right now. Any kind of help will be appreciated!

3 Likes