Instead of computing the random damage value only once at the beginning of your script, compute them whenever you need them. That would probably be in your attack function.
Maybe you are misunderstand something here: Math.random
doesn’t return some special magical value which changes every time it’s read. It returns a number and that number doesn’t change.
If you want multiple random values, you have to call Math.random
multiple times. If you want a different random value whenever the goblin attacks, you have to call Math.random
when it attacks.
1
solved Math.Random is not so random