Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would i change values using Datastores?

Asked by 8 years ago

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

01local event1 = Instance.new("RemoteEvent",game.ReplicatedStorage)--outfit1
02event1.Name = "outfit1"
03local event2 = Instance.new("RemoteEvent",game.ReplicatedStorage)
04event2.Name = "outfit2"
05local event3 = Instance.new("RemoteEvent",game.ReplicatedStorage)
06event3.Name = "outfit3"
07 
08 
09event1.OnServerEvent:connect(function(player,plr,data)
10    print 'fired'
11    local outfit1 = game:GetService("DataStoreService"):GetDataStore("Outfit1")
12    local key = "player-"..plr.userId
13    local plrstats = plr.Customization--Order in stats are saved {Hairs,Face,Shirt,Pants,Accessories1-5"}
14 
15    local valsToset = {
View all 54 lines...
0
What do you mean? Setting the values doesn't work? GoldenPhysics 474 — 8y

1 answer

Log in to vote
1
Answered by
einsteinK 145
8 years ago
Edited 8 years ago

In the save, you probably want to set the Value of all the IntValues:

01local event1 = Instance.new("RemoteEvent",game.ReplicatedStorage)--outfit1
02event1.Name = "outfit1"
03local event2 = Instance.new("RemoteEvent",game.ReplicatedStorage)
04event2.Name = "outfit2"
05local event3 = Instance.new("RemoteEvent",game.ReplicatedStorage)
06event3.Name = "outfit3"
07 
08 
09event1.OnServerEvent:connect(function(player,plr,data)
10    print 'fired'
11    local outfit1 = game:GetService("DataStoreService"):GetDataStore("Outfit1")
12    local key = "player-"..plr.userId
13    local plrstats = plr.Customization--Order in stats are saved {Hairs,Face,Shirt,Pants,Accessories1-5"}
14 
15    local vals = {
View all 55 lines...
0
bro thanks a ton for that xlaser23 60 — 8y
Ad

Answer this question