Attribute Value
We can listen to changes to the attribute with AttributeValue
local hitCount = AttributeValue.new(part, "HitCount")
print(hitCount:get()) -- false
AttributeValue
can update from:
Calling :set()
on the AttributeValue
hitCount:set(0)
hitCount:get() -- 0
task.wait() -- Weave update cycle applies next frame
print(damaged:GetAttribute("HitCount")) -- 0
Calling SetAttribute()
on the Instance
part:SetAttribute("HitCount", 1)
print(hitCount:get()) -- 1