What I mean by Models is that in a game I'm working on, it requires to save a players three characters and all the base equipment they're using, e.g. the brick color, the mesh and the hats. It's like what happens in Vampire Hunters 2 or Apocalypse Rising when you load up a game.
✓ ANSWER ACCEPTED
How can I use Datastores to save models?
1 answer
✓ Accepted answer
Data Stores are not able to save Instances so you would therefore need to put all your data into a table or something like that and save it using that, here's an example:
local ds = game:GetService("DataStoreService")
local Stats = ds:GetDataStore("Stats")
game.Players.PlayerRemoving:connect(function(plr)
local key = "user_"..plr.userId
Stats:SetAsync(key, {goldKnife = true, goldGun = false})
end)
Then loading would be like this:
local ds = game:GetService("DataStoreService")
local Stats = ds:GetDataStore("Stats")
game.Players.PlayerAdded:connect(function(plr)
local key = "user_"..plr.userId
local stats = Stats:GetAsync(key)
if stats and stats.goldKnife then
game.ReplicatedStorage.Knife:Clone().Parent = plr.StarterGear
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
The best thing to do is store the information into a table and datastore the table, IMO.