#My custom function is producing an error if my mob dies before system.runTimeout ends

1 messages · Page 1 of 1 (latest)

flat tundra
#

I have a custom function that tags a mob and after 3 seconds the tag gets removed; however, if the mob dies before those 3 seconds are up an error will pop up.

Here's the code:


  target.addTag(tag);
  system.runTimeout(() => {

    if (target) {

      target?.removeTag(tag);
    }
  }, ticks)
})```
opal karma
#

Why are you using a variable

#

And a function expression?

#

It's not like it's a useless thing

#

But whatever I wanna know what's the error