data.AddedEvent = function(player)
local Inventory = Instance.new("Folder", player); Inventory.Name = "Inventory"
local playerGold = Instance.new("IntValue", Inventory); playerGold.Name = "Gold"
--// Inventory System
local playerArmour = Instance.new("StringValue", Inventory); playerArmour .Name = "Armour"
local playerPotions = Instance.new("StringValue", Inventory); playerPotions .Name = "Potions"
local playerWeapons = Instance.new("StringValue", Inventory); playerWeapons .Name = "Weapons"
--// Player Stats
local playerHealth = Instance.new("IntValue", Inventory); playerHealth.Name = "Health"
local playerDamage = Instance.new("IntValue", Inventory); playerDamage.Name = "Damage"
local playerMagicDmg = Instance.new("IntValue", Inventory); playerMagicDmg.Name = "MagicDamage"
--// Datastore
local goldStore = Datastore2("Gold", player); local goldStoreData = goldStore:Get()
local armourStore = Datastore2("Armour", player); local armourStoreData = armourStore({})
local potionsStore = Datastore2("Potions", player); local potionsStoreData = potionsStore({})
local weaponsStore= Datastore2("Weapons", player); local weaponsStoreData = weaponsStore({})
local healthStore = Datastore2("Health", player); local healthStoreData = healthStore:Get()
local damageStore = Datastore2("Damage", player); local damageStoreData = damageStore:Get()
local magicStore = Datastore2("MagicDamage", player); local magicStoreData = magicStore:Get()
--// JSON Encode/Decode
playerArmour.Value = HttpService:JSONEncode(armourStoreData) -- Turning your items into a JSON table. we don't need to do this for gold as gold is a number and wont have multiple items inside
armourStore:OnUpdate(function(decodedData)
playerArmour.Value = HttpService:JSONEncode(decodedData) -- Encodes newly updated data
end)
playerPotions.Value = HttpService:JSONEncode(potionsStoreData)
potionsStore:OnUpdate(function(decodedData)
playerPotions.Value = HttpService:JSONEncode(decodedData) -- Encodes newly updated data
end)
playerWeapons.Value = HttpService:JSONEncode(weaponsStoreData)
weaponsStore:OnUpdate(function(decodedData)
playerWeapons.Value = HttpService:JSONEncode(decodedData) -- Encodes newly updated data
end)
end
So this is my currenct datastore and for some reason when it gets to line 25 (which is the line under the datastore comment, about the armourstore) it says called a table value, and this is meant to be a table so I’m not sure, Also I’m new to scripting so sorry for the messy script.