I'm kind of new to this community and I would highly appreciate the help. I just recently discovered that saving BoolValues on DataStore is possible. I would like to know for a way to save StringValues on DataStore since it doesn't save on my script.

Feel free edit my script to solve this problem.

Local Data- {
["Using"] = {"StringValue"; "None" };
["Character1"] =  {"BoolValue"; true}
}
local DataStoreService = game:GetService("DataStoreService")

game.Players.PlayerAdded:connect(function(Player)
    UserId = Player.userId
    local Folder = Instance.new("Folder",Player)
    Folder.Name = "Chars"
    for Name,Info in pairs(Data) do
        local Type, Default = unpack(Info)
        Store = DataStoreService:GetDataStore(Name)
        Stat = Instance.new(Type,Folder)
        Stat.Name = Name
        local Save = Store:GetAsync(UserId)
        Stat.Value = Save or Default
        Stat.Changed:connect(function()	
            Store:SetAsync(UserId,Stat.Value)
        end)
    end
end)

How would I make it able to save the StringValue's Value when/if Stat.Changed:connect() doesn't trigger the SetAsync.?

Thank you for taking the time to read my concerns.

2 comments

0

use :Connect not :connect bcs its deprecated

0

@mixgingengerinal10 Sorry, your answer is irrelivant to my point, even when I change it to "Connect" it still doesn't save the StringValue