hello, i am trying to make a shop system where if you buy a character it gets added to a datastore so it is saved the next time you play. at first it worked, but then when i changed the datastore name and removed the old datastore, it stopped working (i did not change the code for the datastore, i just renamed it). So when you buy something it is inserted to the end of the Characters table and it prints out the table but it’s only the 2 starter characters in the table, not the characters bought which should be in there. i probably did do something wrong with the code since im not very good with using datastores
Remote.OnServerEvent:Connect(function(player,Function,rename)
if Function == "AddOwnedCharacter" then
if sessionData[player.UserId] then
table.insert(sessionData[player.UserId].Characters,rename)
print(sessionData[player.UserId].Characters)
end
end
end)