Hey Roblox devs! I’m trying to make a system in my game where you can load, save, and delete data. I wasn’t sure how I was going to apporach this, but I figured I should start with whatever I know and go from there. This is what I have right now:
local DataStoreService = game:GetService("DataStoreService")
--[[
I want to have data store which slots a player has data on, and which slots a
player doesn't have data on. I figured I can make it into a table, but I'm fairly
new to data storing so if anyone has a better solution to this please let me
know.
--]]
local SlotsOpened = {}
--[[
I think this is how you do it...I want different data storing for each slot a
player has. Lets say a player has two slots with different game data on them.
I would have the "Slot1" variable store one of the player data, and "Slot2"
hold the other one. Again, let me know if something is wrong and inform me how I
would approach this in the best way possible.
--]]
local Slot1 = DataStoreService:GetDataStore("Slot1")
local Slot2 = DataStoreService:GetDataStore("Slot2")
local Slot3 = DataStoreService:GetDataStore("Slot3")
--[[
The other thing is, I want to have it so you can only load data if your playing
single player, for obvious reasons. Loading multiplayer data wouldn't make
that much sense, plus it would be way more complicated for me.
--]]
if game.ReplicatedStorage["# of players in game"].Value == 1 then
game.Players.PlayerAdded:Connect(function(player)
end)
end
please, let me know the best way I can approach this kinda thing and inform me about data stores. I already have the gui menu ready for selecting slots, and deleting slots. I’m having a lot of trouble with the code itself though, as I have no clue where to even start.