If I had a combat game and needed to store data such as if the player is blocking or not, which of these would be the better way of doing things?
local Players = game:GetService('Players')
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character:SetAttribute('Blocking', false)
Character:SetAttribute('Disabled', false)
Character:SetAttribute('Attacking', false)
end)
end)
or
local Players = game:GetService('Players')
local Table = {}
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Table[Character] = {
['Blocking'] = false,
['Disabled'] = false,
['Attacking'] = false
}
end)
Player.CharacterRemoving:Connect(function(Character)
Table[Character] = nil
end)
end)
return Table
The first one is in a server script and the second one is in a module script.
Edit: I forgot to mention that I intend to store more data like damage reduction and damage multiplier values.