Greetings DevForum,
I am currently designing a datastore with multiple data values in the form of integers and wanted to know if I should simply redo my code as a new datastore for my “Defense” value or if there is some way to add a “Defense” value to my Attack datastore. I need to be able to increment Attack and Defense separately and was not sure if a table would suffice to do that.
local DataStore2 = require(1936396537)
local defaultAttackValue = 1000
local TitlesAndClothingTable = {Default = false}
game.Players.PlayerAdded:Connect(function(player)
print("Data Loaded")
local AttackDataStore = DataStore2("AttackDataStore", player)
local AttackValue = Instance.new("IntValue")
AttackValue.Parent = player
AttackValue.Name = "Attack"
local Folder = Instance.new("Folder")
Folder.Parent = player
Folder.Name = "TitlesAndClothing"
local function AttackUpdate(value)
AttackValue.Value = AttackDataStore:Get(value)
end
AttackUpdate(defaultAttackValue)
AttackDataStore:OnUpdate(AttackUpdate)
end)
game.ReplicatedStorage.DataUpdate.OnServerEvent:Connect(function(player, value)
local AttackDataStore = DataStore2("AttackDataStore", player)
AttackDataStore:Increment(value, defaultAttackValue)
end)