Hi there, I’m a decent Roblox scripter but I am not so good with Datastores.
I need help creating a data store that saves all items inside of a folder.
example
there’s a character customizer and a user buys a “face” then there’s a folder in ReplicatedStorage called “OwnedFaces” and it adds 1 StringValue with the textureID of that face he just bought and the same thing happens again when you buy another face so you have a list of all the faces you bought
Example picture
I want to save that folder and then give it back to the player when he joins back.
You can contact me to help either by replying or discord AccessQ#3236.
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("DataStoreNameHere")
--Saving
game.Players.PlayerRemoving(function(plr)
local folder = --FolderHere
local Data = {}
for i,Glider in pairs (folder:GetChildren())
Data[i] = Glider.Value
end
--Save "Data" variable to the datastore
end)
--Loading
game.Players.PlayerAdded:Connect(function(plr)
local Data
--Get the data from the DataStore
local folder = --FolderHere
for i,Glider in pairs(Data) do
local newvalue = Instance.new("StringValue",folder)
newvalue.Name = i
newvalue.Value = Glider
end
end)
Check this page (Documentation - Roblox Creator Hub) to see what you can do on --Save "Data" variable to the datastore and --Get the data from the DataStore
Quick note, if you want to hire someone you can do so in #collaboration:recruitment. You can’t ask for scripts as this is against the Community Guidelines. Feel free to ask for ways to go about something!