ive used GetAsync() as in a variable then looped my table "ValsToset" with the datastore table "saves" to set the values but everytime i try to get the values they wouldnt be able to set
local event1 = Instance.new("RemoteEvent",game.ReplicatedStorage)--outfit1
event1.Name = "outfit1"
local event2 = Instance.new("RemoteEvent",game.ReplicatedStorage)
event2.Name = "outfit2"
local event3 = Instance.new("RemoteEvent",game.ReplicatedStorage)
event3.Name = "outfit3"
event1.OnServerEvent:connect(function(player,plr,data)
print 'fired'
local outfit1 = game:GetService("DataStoreService"):GetDataStore("Outfit1")
local key = "player-"..plr.userId
local plrstats = plr.Customization--Order in stats are saved {Hairs,Face,Shirt,Pants,Accessories1-5"}
local valsToset = {
plrstats.Hair.Value,
plrstats.Hair2.Value,
plrstats.Face.Value,
plrstats.Shirt.Value,
plrstats.Pants.Value,
plrstats.Accessory1.Value,
plrstats.Accessory2.Value,
plrstats.Accessory3.Value,
plrstats.Accessory4.Value,
plrstats.Accessory5.Value,
}
local saves = outfit1:GetAsync(key)
if data == "save" then
print 'saving'
outfit1:SetAsync(key,valsToset)
print 'saved'
for i,v in pairs(valsToset) do
print(v)
end
elseif data == "load" then--looping the tables values with saved to load them in
print 'loading'
for i,v in pairs(valsToset) do
valsToset[i] = saves[i]
print(valsToset[i])
end
elseif data == "check" then
print 'checking'
for i,v in pairs(saves) do
print(saves[i])
end
end
end)

1 comment
What do you mean? Setting the values doesn't work?