How would i change values using Datastores?
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
01 | local event 1 = Instance.new( "RemoteEvent" ,game.ReplicatedStorage) |
02 | event 1. Name = "outfit1" |
03 | local event 2 = Instance.new( "RemoteEvent" ,game.ReplicatedStorage) |
04 | event 2. Name = "outfit2" |
05 | local event 3 = Instance.new( "RemoteEvent" ,game.ReplicatedStorage) |
06 | event 3. Name = "outfit3" |
09 | event 1. OnServerEvent:connect( function (player,plr,data) |
11 | local outfit 1 = game:GetService( "DataStoreService" ):GetDataStore( "Outfit1" ) |
12 | local key = "player-" ..plr.userId |
13 | local plrstats = plr.Customization |
21 | plrstats.Accessory 1. Value, |
22 | plrstats.Accessory 2. Value, |
23 | plrstats.Accessory 3. Value, |
24 | plrstats.Accessory 4. Value, |
25 | plrstats.Accessory 5. Value, |
29 | local saves = outfit 1 :GetAsync(key) |
31 | if data = = "save" then |
33 | outfit 1 :SetAsync(key,valsToset) |
35 | for i,v in pairs (valsToset) do |
39 | elseif data = = "load" then |
41 | for i,v in pairs (valsToset) do |
42 | valsToset [ i ] = saves [ i ] |
45 | elseif data = = "check" then |
47 | for i,v in pairs (saves) do |