How do i create the second value too?
i do not get any errors but "red" does not get created, unless i move it above "WhichSelected" but then "WhichSelected" does not get created
01 | local players = game:GetService( "Players" ) |
02 | local datastore = game:GetService( "DataStoreService" ) |
03 | local ds 1 = datastore:GetDataStore( "Gs165g61g6sg16G6" ) |
04 | local ds 2 = datastore:GetDataStore( "Gsga1hs61sd5j1sj6s1" ) |
06 | players.PlayerAdded:connect( function (player) |
07 | local folder = Instance.new( "Folder" ) |
08 | folder.Name = "Colors" |
09 | folder.Parent = player |
11 | local WhichEquipped = Instance.new( "StringValue" ) |
12 | WhichEquipped.Name = "WhichIsEquipped" |
13 | WhichEquipped.Parent = player |
14 | WhichEquipped.Value = ds 1 :GetAsync(player.UserId) or "Red" |
15 | ds 1 :SetAsync(player.UserId, WhichEquipped.Value) |
17 | local red = Instance.new( "BoolValue" ) |
18 | red.Name = "RedUnlocked" |
19 | red.Parent = player.Colors |
20 | red.Value = ds 2 :GetAsync(player.UserId) or false |
21 | ds 2 :SetAsync(player.UserId, red.Value) |
23 | WhichEquipped.Changed:connect( function () |
24 | ds 1 :SetAsync(player.UserId, WhichEquipped.Value) |
26 | red.Changed:connect( function () |
27 | ds 2 :SetAsync(player.UserId, red.Value) |
i think something is wrong with these lines
1 | red.Value = ds 2 :GetAsync(player.UserId) or false |
2 | ds 2 :SetAsync(player.UserId, red.Value) |