Setting exp via table saved to datastore problem

  1. What do you want to achieve? Keep it simple and clear!
    So i’m making leveling system for my FPS game.

  2. What is the issue? Include screenshots / videos if possible!
    By some weird error i get that

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    This datastore code is always worked in every my game and still works, this is first problem like that with it. Do not recommend me other datastore scripts please, this one works perfectly.

Code where error possible happens:

--DS values
...
local success, data = LoadData(player)
	sessionData[player.UserId] = success and data or {
		Values = {
		
		["Kills"] = 0,
		["Deaths"] = 0,
		["MVPs"] = 0,
		
		},
		
		LevelStorage = {
				["Level"] = 0,
				["Exp"] = 0,
				["RequiredExp"] = 40
		},
		
		InventorySet = {
			["Primary"] = {
				["Class"] = "AssaultRifles",
				["Weapon"] = "AK105"
			},
			["Secondary"] = {
				["Class"] = "Pistols",
				["Weapon"] = "Glock 19"
			},
			["Knife"] = {
				["Class"] = "Knifes",
				["Weapon"] = "DefaultKnife"
			},
		}
		
	}
...
--Function
...
function PlayerManager.UpdateLevelValue(player, value, valueAmount)
	
	print(value)
	
	if sessionData[player.UserId]["LevelStorage"][value] then
		sessionData[player.UserId]["LevelStorage"][value] = valueAmount
		end
end
...

Btw value prints out Exp as it should
image

The issue is that sessionData[player.UserId] is nil, the print statement doesn’t say much. Maybe your data is corrupted because the default table was changed? You should print sessionData and data instead.

It Always worked before correctly + i reset data of all players in game like 5 times(so it should make empty preset data)

Awwwwww i found corrupted thing, fixed everything

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.