local function setupdata(player)
local playeruserid = player.UserId
local data = PlayerDataStore:GetAsync(player.UserId)
if data then
PlayerData[player.UserId] = data
else
PlayerData[player.UserId] = {
Head = "";
Neck = "";
Waist = "";
Back = "";
Currency = 0; --default the currency to 0
Inventory = {}; --default to an empty inventory
}
end
rfunc:FireClient(player, PlayerData[player.UserId]["Inventory"])
end
local function noob(player,humanoid, defaultHumanoidDescription)
print(PlayerData[player.UserId]["Head"])
print(PlayerData[player.UserId]["Back"])
defaultHumanoidDescription.HatAccessory = PlayerData[player.UserId]["Head"]
defaultHumanoidDescription.NeckAccessory = PlayerData[player.UserId]["Neck"]
defaultHumanoidDescription.WaistAccessory = PlayerData[player.UserId]["Waist"]
defaultHumanoidDescription.BackAccessory = PlayerData[player.UserId]["Back"]
addhead.OnServerEvent:Connect(function(player, aid)
print(aid)
local Inventory = PlayerData[player.UserId]["Inventory"]
for i, v in pairs (Inventory) do
if tonumber(aid) == tonumber(v) then
PlayerData[player.UserId]["Head"] = aid
local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")
local defaultHumanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
noob(player,humanoid, defaultHumanoidDescription)
humanoid:ApplyDescription(defaultHumanoidDescription)
print(aid)
end
end
end)
so since I gave the head datastore a value, the script can read it fine, but the ones I previously defined as "" get read as nil? can I not set my datastore values to ""?

3 comments
No
Nil is value not set, while "" will be equal to () in the output. Trust me, I tested.
ok