So an issue with my datastore system is that after I added an additional 3 values {jutsu1,jutsu2,jutsu3} I get this error message
" Unable to assign property Value. string expected, got nil - Server - Currency:71"
I would understand the issue however the exact same code for previous storages worked without getting this error. This also occurred with the exact same system on a different game that broke the datastore completely and forced me to delete the system and make it again. I don’t understand why I would get the error especially since the code worked before I added the 3 extra values. The code is below.
local DataStoreService = game:GetService(“DataStoreService”)
local playerData = DataStoreService:GetDataStore(“PlayerData”)
local function onPlayerJoin(player) – Runs when players join
local sabe = player:WaitForChild(“DataFolder”)
local money = Instance.new("IntValue") --Sets up value for leaderstats
money.Name = "Ryo"
money.Parent = sabe
local exp = Instance.new("IntValue") --Sets up value for leaderstats
exp.Name = "CombatXP"
exp.Parent = sabe
local armor = Instance.new("StringValue") --Sets up value for leaderstats
armor.Name = "Armor"
armor.Parent = sabe
local hair = Instance.new("StringValue") --Sets up value for leaderstats
hair.Name = "Hair"
hair.Parent = sabe
local jutsu = Instance.new("StringValue") --Sets up value for leaderstats
jutsu.Name = "Jutsu1"
jutsu.Parent = sabe
local jutsu2 = Instance.new("StringValue") --Sets up value for leaderstats
jutsu2.Name = "Jutsu2"
jutsu2.Parent = sabe
local jutsu3 = Instance.new("StringValue") --Sets up value for leaderstats
jutsu3.Name = "Jutsu3"
jutsu3.Parent = sabe
local playerUserId = "Player_" .. player.UserId --Gets player ID
local data = playerData:GetAsync(playerUserId) --Checks if player has stored data
if data then
money.Value = data['Ryo']
exp.Value = data['CombatXP']
armor.Value = data['Armor']
hair.Value = data['Hair']
jutsu.Value = data['Jutsu1']
jutsu2.Value = data['Jutsu2']
jutsu3.Value = data['Jutsu3']
else
-- Data store is working, but no current data for this player
money.Value = 0
exp.Value = 0
armor.Value = "none"
hair.Value = "bald"
jutsu.Value = "none"
jutsu2.Value = "none"
jutsu3.Value = "none"
end
end