✓ Accepted answer
The proper way to convey your request is more along the lines on "How to save a table". The only way to do so on Roblox, excluding HttpService, would be through DataStores.
Let us break down what we are trying to do and how first. The simplest way to explain it is how to save a table use DataStores. Although, you specifically discuss an inventory, showing we need to save information on a player-to-player basis.
local DataStore = game:GetService("DataStoreService")
local InventoryData = DataStore:GetDataStore("Inventory")
game.Players.PlayerAdded:Connect(function(Plr)
if not InventoryData:GetAsync(tostring(Plr.UserId)) then
InventoryData:SetAsync(tostring(Plr.UserId), {})
end
end)
Please keep in mind, all the above code does (assuming it works, did not use studio to type or test) is save a table to the player under a key, key being how you get their unique data, which is their userid. We use a userid because it will never change for their account, unlike name which can be changed.
If there are issues or questions, feel free to comment below!
Almost forgot, here is a great link on how to use DataStores
2 comments
use HttpService to convert the table to JSON and then upload that to the datastore
Many people have been using DataStore2 by Kampfkarren and it is makes saving so much easier. Definitely check it out: https://devforum.roblox.com/t/how-to-use-datastore2-data-store-caching-and-data-loss-prevention/136317