MZ .requestAnimation script call not working

Apologize if this is not the right place to post this, but I am trying to select two random events and play an animation using the following scripts (using MZ with Visustella plugins):

Spoiler: Code Snippet
JavaScript:
const pevents = [12];

for (let i = 234; i < 251; i++) {

  pevents.push(i);

}

var p = pevents[Math.floor(Math.random()*pevents.length)];

var character = $gameMap.event(p);

character.requestAnimation(191);





const eevents = [2];

for (let i = 163; i < 180; i++) {

  eevents.push(i);

}

var e = eevents[Math.floor(Math.random()*eevents.length)];

var character = $gameMap.event(e);

character.requestAnimation(190);

However, the animations are not firing and I get the following error message:

script call error.PNG

Most of the references to ".requestAnimation" I have found through google are MV-related, so I am wondering if this script call is no longer valid or have I just screwed up the syntax.

Thank you.
"requestAnimation is not a function" tells you exactly what the problem is:

requestAnimation is not defined anywhere in your project.

And that can have only two possible causes:
1) typo: the function has a different name
2) missing plugin: the plugin that defines that function is not active in your project.

So where exactly did you get that function name from?
It's different for RMMZ:
JavaScript:
$gameTemp.requestAnimation(targets, animationId, mirror);
E.g. to show animation ID 5 on "This Event", try this in a Script command:
JavaScript:
$gameTemp.requestAnimation([this.character(0)], 5);
If you're using it in a move route, replace this.character(0) with this.
It's different for RMMZ:
JavaScript:
$gameTemp.requestAnimation(targets, animationId, mirror);
E.g. to show animation ID 5 on "This Event", try this in a Script command:
JavaScript:
$gameTemp.requestAnimation([this.character(0)], 5);
If you're using it in a move route, replace this.character(0) with this.

When I tried this it work like this for me. Using this played the animation but I could only hear the sound, I don't know where it was assigning the animation to.

JavaScript:
 $gameTemp.requestAnimation([$gamePlayer], 6);

Original thread: https://forums.rpgmakerweb.com/threads/requestanimation-script-call-not-working.138137/