Attempt to perform arithmetic (div) on nil and number

Here is the problem:
image
This function needs the “monster” to work, but when I try to index anything from it returns nil. It prints out this.

It definitely has to do something with the fact that these are “classes” (the luau equivalent of them)
Here is what I mean by that:

I really do not understand metatables that well. I just found a tutorial on OOP in roblox.

here is how the function is called.
image

one more thing… if u dont understand what I am working on then its a pokemon-like battle system (I know that if I used any pokemon trademarked stuff I would get a DMCA) if there is somehow anyone with experience with making this then please tell me.

thanks

mon.maxhp is nil that’s why it returns that error
i assume the fix could be mon.MaxHealth since maxhp is not a property of humanoid

1 Like

uhh… mon is a class, not a humanoid, its not an instance, I wish the explanation was that easy. check the third picture.