I am developing a game where each player has an inventory. Each item has a separate bool value stored in the player. Once the player gets a specific item it changes its bool value to true
How would I go about storing all of the item’s bool value in one datastore rather than a datastore for every item? How would I also go about retrieving all of the items bool value from one datastore?
I could not think how to achieve this and everything I have tried had not worked
This is what the player looks like in-game if it helps:
The script that sets up all of the items:
local Players = game:GetService("Players")
local Arrows = {"Default", "Blue", "Red", "Yellow", "Rainbow", "Developer"}
Players.PlayerAdded:Connect(function(Player)
local Inventory = Instance.new("Folder")
Inventory.Parent = Player
Inventory.Name = "Inventory"
local ArrowsFolder = Instance.new("Folder")
ArrowsFolder.Parent = Inventory
ArrowsFolder.Name = "Arrows"
for _, a in pairs(Arrows) do
local newArrow = Instance.new("BoolValue")
newArrow.Name = a
newArrow.Parent = ArrowsFolder
if a == "Default" then
newArrow.Value = true
else
newArrow.Value = false
end
end
end)
Thanks if you can help <3