Hello everyone, I was making the datastore script of my loadout system. Recently, I noticed a error that said, “Unable to assign property Value. string expected, got nil” in line 42.
Here’s a script:
local onJoinTable = {
[true] = function(player, result)
print("No data has found")
local LoadoutClass = require(script.LoadoutClass).new(player)
loadoutclass[Players:GetUserIdFromNameAsync(player.Name)] = LoadoutClass
-- loadoutclass
local KeybindSetup = require(script.KeybindSetup).new(player)
keybindclass[Players:GetUserIdFromNameAsync(player.Name)] = KeybindSetup
print(LoadoutClass)
end,
[false] = function(player, result)
print("Player data has found")
local LoadoutClass = require(script.LoadoutClass).new(player, HttpService:JSONDecode(result))
local KeybindSetup = require(script.KeybindSetup).new(player, HttpService:JSONDecode(result))
LoadoutClass:SetCharacter(player.Character)
LoadoutClass:SetName(player.Name)
player.KeybindsFolder.OpenSettings.Value = KeybindSetup.OpenSettings
player.LoadoutFolder.NationName.Value = LoadoutClass.NationName -- the error
player.LoadoutFolder.RegimentName.Value = LoadoutClass.RegimentName
player.LoadoutFolder.IsAssigned.Value = LoadoutClass.IsAssigned
task.wait()
player:LoadCharacter()
print(LoadoutClass)
loadoutclass[Players:GetUserIdFromNameAsync(player.Name)] = LoadoutClass
keybindclass[Players:GetUserIdFromNameAsync(player.Name)] = KeybindSetup
end,
}
After finishing the code, the error appear when I start to join. Then, when I rejoined back, I still keep seeing the same error again. I would appreciate anyone who decides to fix it.