[DataStore2] - How do I save an string object?

Keeping it simple and clear. How can I make DataStore2 save an String Value? Example: I have an custom folder in leaderstats named “TowersEquipped” and basically when a String Value gets inserted there and the player leaves to join back it’s still there even consisting with the value.

However I do not know how to achieve this.

This is needed for my tower defense game to save tower’s data. I know how to get data from universal places now but the question is relating to the topic title.

Any responses relating to the topic is greatly appreciated.

2 Likes

can’t you just do

local ds2 = require(DataStore2)

ds2.Combine('Stuff','Name')

game.Players.PlayerAdded:Connect(function(player)

        local String = ds2('String',player):Get('String')
       print(String)
   
end)

game.Player.PlayerRemoving:Connect(function(player)
        ds2('String',player):Set('testing1')
end)

1 Like