I’ve tried but I didn’t know what the key to do it
I want to make it similar to adventure story
can you provide more information to what you are trying to make?
Like :
File one : Load Game / Cash : 1432 , Rebirth : 2 / Delete File
File two : Load Game / Cash : 13 , Rebirth : 1 / Delete File
File three : New Game
i think you can use multiple datastores to handle each file but i personally wouldn’t recommend it, use profileservice and keep it all in one single datastore, and have all three files in separate tables
as for loading and all the scripts it is personally up to you, you can have a main menu with load buttons for each file then load the player’s data
vague explanation, i know
Why you wouldn’t recommend it? It wont impact perfomance since they only have to deal with the loaded profile during gameplay(so same amount of datastore requests). Also if each save is a different datastore key they have 4MB of space for each save, which is ideal if the game grows and that space is actually needed. They can separate that datastore from the main player datastore and add a table “saves” in their main datastore with all the references/keys for their saves(instead of the entire save data).
I am in alignment with your analysis. But I would probably still use one datastore for simplicity
It really depends on what they’re saving. If any building data or complicated inventory list that can have infinite items is in there I would go with the multiple keys option. If the data is a few values of finite size that doesn’t exceed a limit of lets say 100KB I would go with the same key option.
It’s worth mentioning that one of the main cons of using the same key for multiple saves is that if their size is large, it will impact the amount of maximum slots a user can have.
Profileservice like this ?
MikeartsRBLX
local profileservice = require(game.ServerScriptService.ProfileService)
local template = {
hair1 = 0,
hair1R = 0,
hair1G = 0,
hair1B = 0,
hair2 = 0,
hair2R = 0,
hair2G = 0,
hair2B = 0,
pant = 0,
shirt = 0,
skinColorR = 0,
skinColorG = 0,
skinColorB = 0,
money = 0,
}
local players = game:GetService("Players")
local profileStore = profileservice.GetProfileStore(
"FileSlot1",template
)
local DataManager = {}
DataManager.Profiles = {}
local function onPlayerAdded(player)
local profile = profileStore:LoadProfileAsync(
"Player_"..player.UserId
)
if profile then
profile:ListenToRelease(function()
DataManager.Profiles[player] = nil
player:Kick("Data Released")
end)
if player:IsDescendantOf(players) then
DataManager.Profiles[player] = profile
profile:Reconcile()
else
profile:Release()
end
else
player:Kick("Data Failed to Load")
end
end
local function onPlayerRemoving(player)
local profile = DataManager.Profiles[player]
if profile then
profile:Release()
end
end
players.PlayerAdded:Connect(onPlayerAdded)
players.PlayerRemoving:Connect(onPlayerRemoving)
for _, player in ipairs(players:GetPlayers()) do
task.spawn(onPlayerAdded, player)
end
return DataManager
i don’t exactly know how to implement having multiple datastores in profileservice yet.
Is there is more ways?
local template = {
hair1 = 0,
hair1R = 0,
hair1G = 0,
hair1B = 0,
hair2 = 0,
hair2R = 0,
hair2G = 0,
hair2B = 0,
pant = 0,
shirt = 0,
skinColorR = 0,
skinColorG = 0,
skinColorB = 0,
money = 0,
}
these are just small amount of it there will be more variable
Also how to exactly display data?
local FirstFileSlot = DataStore:GetDataStore("FileSlot1")
local SecondFileSlot = DataStore:GetDataStore("FileSlot2")
local ThirdFileSlot = DataStore:GetDataStore("FileSlot3")
like FirstFileSlot.SkinColor ?? idk tho
EDIT : there is a way to display
you could do something like this, however it might take up more data
local template = {
FileSlot1 = { -- File slot 2, and so on
hair1 = 0,
hair1R = 0,
hair1G = 0,
hair1B = 0,
hair2 = 0,
hair2R = 0,
hair2G = 0,
hair2B = 0,
pant = 0,
shirt = 0,
skinColorR = 0,
skinColorG = 0,
skinColorB = 0,
money = 0,
}
}
i’m not that familiar with datastores, i think @NyrionDev could help you further
Basically they have to figure out how to structure their data depending on their game logic. For example it can be something like:
local template = {
--global player values unrelated to their current save
FirstJoinTime = 0,
Saves = {
Slot1 = {
--values related to the slot1 save
hair1 = 0,
hair1R = 0,
--etc
},
Slot2 = {},
Slot3 = {},
--etc
}
}
local Items = {
Hair1 = {
Id = 0,
R = 0,
G = 0,
B = 0,
},
Hair2 = {
Id = 0,
R = 0,
G = 0,
B = 0,
},
SkinColor = {
R = 0,
G = 0,
B = 0,
},
Shirt = 0,
Pant = 0,
}
Already done that so…
that’s what i was thinking, but wouldn’t that take up data? let’s just say the game is pretty big and has alot of stuff
They have 4MB of space, even if the data isn’t compressed it should take much less. Unless they do something that actually requires space like a super complicated system of pets, skins, items etc. or a building system that is dynamic with many parameters.
btw how to transfer file data?
you mean as in transferring data from file slot n > file slot n?
oh sorry what I meant to say is transfer to another experience/game
What exactly are you trying to do? As long as API services is turned on, in any separate place (in the game) data will be carried over