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

How do i create the second value too?

Asked by 4 years ago

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

local players = game:GetService("Players")
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("Gs165g61g6sg16G6")
local ds2 = datastore:GetDataStore("Gsga1hs61sd5j1sj6s1")

players.PlayerAdded:connect(function(player)
    local folder = Instance.new("Folder")
    folder.Name = "Colors"
    folder.Parent = player

    local WhichEquipped = Instance.new("StringValue")
    WhichEquipped.Name = "WhichIsEquipped"
    WhichEquipped.Parent = player
    WhichEquipped.Value = ds1:GetAsync(player.UserId) or "Red"
    ds1:SetAsync(player.UserId, WhichEquipped.Value)

    local red = Instance.new("BoolValue")
    red.Name = "RedUnlocked"
    red.Parent = player.Colors
    red.Value = ds2:GetAsync(player.UserId) or false
    ds2:SetAsync(player.UserId, red.Value)

    WhichEquipped.Changed:connect(function()
        ds1:SetAsync(player.UserId, WhichEquipped.Value)
    end)
    red.Changed:connect(function()
        ds2:SetAsync(player.UserId, red.Value)
    end)

end)

i think something is wrong with these lines

red.Value = ds2:GetAsync(player.UserId) or false
    ds2:SetAsync(player.UserId, red.Value)
0
Are there any errors printed to the output? And when you mean "red" does not get created, do you mean the datastore entry or the BoolValue? compUcomp 417 — 4y
0
there are no errors, and i mean the bool value VykaGaming 7 — 4y
1
set red's parent to folder. So line 19 should say red.Parent = folder killerbrenden 1537 — 4y
0
You have to make another int value but you have to make the leaderstats the values parent like: InspireWithFun 9 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

If you want to make 2 int values then you have to make 2 int values like try making 2 int values but set their parent to the leaderstats folder that you created.

Ad

Answer this question