Hello, I am needing help on seperating my string/data in a DataStore. What I am currently doing is trying to save the Players purchased cars and then saving that in a DataStore, but my output shows the strings having no seperation between them. I am expecting an output of this:
{
"New Vehicle1",
"New Vehicle2"
}
But I am getting an output of this:
NewVehicle1,NewVehicle2
The way I am saving my data is this way (full script)
local Players = game:GetService('Players')
local DSS = game:GetService('DataStoreService')
local VehicleStorage = DSS:GetDataStore("Dealership_VehicleDataNEW")
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, stat)
if stat == "get" then
local VehicleData = VehicleStorage:GetAsync(player.UserId)
if VehicleData then
for _, itemData in pairs(VehicleData) do
print(itemData)
end
else
VehicleStorage:SetAsync(player.UserId, {})
end
else
local VehicleData = VehicleStorage:GetAsync(player.UserId)
if VehicleData then
local Cars = {
"New Vehicle2",
table.concat(VehicleData, ",")
}
VehicleStorage:SetAsync(player.UserId, Cars)
else
VehicleStorage:SetAsync(player.UserId, {
"New Vehicle2"
})
warn("success")
end
end
end)
The Event is being fired from a TextButton (one button is for saving and one is for getting). Those are just temp buttons. My main issue is with the DataStore. Thanks in advance!