local Data = game:GetService("DataStoreService"):GetDataStore("Saves")
local HS = game:GetService("HttpService")
local Shirts = game.Workspace.Sir.Shirts
game.Players.PlayerAdded:connect(function(player)
local PKey = "user_" .. player.userId
local Stats = Instance.new("Model",player)
Stats.Name = "UserStat"
local SavesLists = HS:JSONDecode((Data:GetAsync(PKey)))
local ShirtColor = Instance.new("StringValue",Stats)
ShirtColor.Name = "ShirtColor"
ShirtColor.Value = tostring(SavesLists[1])
local ShirtType = Instance.new("StringValue",Stats)
ShirtType.Name = "ShirtType"
ShirtType.Value = tostring(SavesLists[2])
if tostring(ShirtColor.Value) == "" then ShirtColor.Value = "Institutional white" end
if tostring(ShirtType.Value) == "" then ShirtType.Value = "1" end
for i,v in pairs(Shirts:GetChildren()) do
for i,d in pairs(v:GetChildren()) do
if d:IsA("BasePart") then
if d.Parent.Name ~= "Shirt"..ShirtType then
d.Transparency = 1
else
d.Transparency = 0
end
d.BrickColor = BrickColor.new(ShirtColor.Value)
end
end
end
function Update()
local Table = {ShirtColor.Value,ShirtType.Value}
local SavesList = HS:JSONEncode(Table)
Saves:SetAsync(P, SavesList)
end
ShirtColor.Changed:connect(function(Val)
Update()
end)
ShirtType.Changed:connect(function(Val)
Update()
end)
end)
Output:
Argument 1 missing or nil at line 13
