Command that has a 20 percent chance

Asked Jan 28, 2023·2 replies·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

So i want to have a comand that has a 20 percent chance of returning a YOU HIT THE BLUE DOT 8 point and the other 80 percent it returns a U MISSED u scored 0

2 replies

Does this work? Im not great with coding so please let me know if it does or doesn't!

!addcom !shoot $(eval var roll = Math.floor(Math.random() * 100) + 1; if (roll <= 20) { "YOU HIT THE BLUE DOT! 8 points" } else { "U MISSED. You scored 0" })
Indigo Turkey said:
```
!addcom !shoot $(eval var roll = Math.floor(Math.random() * 100) + 1; if (roll <= 20) { "YOU HIT THE BLUE DOT! 8 points" } else { "U MISSED. You scored 0" })
```

it worked thank you so much