How to attack a monster player:Attack(monsterId)?

How to attack a monster?

local player = Game.GetLocalPlayer()
player:Attack(monsterId) – does not work

local monster = Character.Get(monsterId)
monster:Attack(playerId) – is work


I assume it does not work at all, because the char is controlled by the player, unlike the monster. So unless the player chooses to attack a monster, it won’t get attacked. Not sure why you would want to force that via script in the first place.

Looking for a way to make the player attack the chosen goal

Not really sure what that means, but you cannot force a player action via scripts. The player variable really only exists to give/take items/tokens.