How can I better use self in this function module:()?

local module = {}

function module:ApplyDamage(self, Char, AttackData)
if Char and AttackData then
if not AttackData.Damage then return end
Char.Humanoid.Health -= AttackData.Damage
end
end

how would I use better use self in this?

3 Likes

That’s not how self works. You don’t specify it as a parameter; it is added automatically for the colon operator used as the dot operator in an object.

4 Likes

would self replace all params?
like self.Char or self.AttackData?

I’m not good at using it or understanding it

1 Like

No, it’s the object.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.