Double Or Nothing Minigame

Heads or tails minigame with double or nothing!

Supported Versions:

1.21.11+

Commands by Row:

Row 1

1. [impulse] /scoreboard objectives add random dummy

Row 2

2. [impulse] /scoreboard objectives add bet dummy

Row 3

3. [impulse] /scoreboard objectives add amount dummy

Row 4

4. [impulse] /scoreboard players set doubleGame bet 2

Row 5

5. [repeat] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] unless score @s random matches 1..2 run tellraw @s "<DOUBLE OR NOTHING> YOU DID NOT PICK HEADS OR TAILS"
6. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] if score @s random matches 1..2 unless entity @s[tag=doubleBet] store result score @s amount run clear @s diamond 0
7. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] if score @s random matches 1..2 unless entity @s[tag=doubleBet] if score @s amount matches 0 run tellraw @s "<DOUBLE OR NOTHING> YOU NEED 1 DIAMOND TO PLAY"
8. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] if score @s random matches 1..2 unless entity @s[tag=doubleBet] if score @s amount matches 1.. run clear @s diamond 1
9. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] if score @s random matches 1..2 unless entity @s[tag=doubleBet] if score @s amount matches 1.. run scoreboard players set @s bet 1
10. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] if score @s random matches 1..2 unless entity @s[tag=doubleBet] if score @s amount matches 1.. run tag @s add doubleBet
11. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] run scoreboard players reset doubleGame timer
12. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] run scoreboard players reset doubleGameFlip timer
13. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] run scoreboard players reset doubleGameTimer timer
14. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -349 6 -42 minecraft:oak_button[powered=true] if score @s random matches 1..2 if entity @s[tag=doubleBet] if score @s amount matches 1.. run setblock -349 6 -42 air

Row 6

15. [repeat] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -348 4 -42 minecraft:oak_button[powered=true] run scoreboard players set @s random 1
16. [chain] /execute as @a at @s if entity @e[tag=doubleOrNothingMachine,distance=..20] if block -350 4 -42 minecraft:oak_button[powered=true] run scoreboard players set @s random 2

Row 7

17. [repeat] /execute unless score doubleGameTimer timer matches ..20 run scoreboard players set doubleGameTimer timer 0
18. [chain] /execute if block -349 6 -42 air if score doubleGameTimer timer matches ..2 run scoreboard players add doubleGame timer 10
19. [chain] /execute if block -349 6 -42 air if score doubleGameTimer timer matches 3..5 run scoreboard players add doubleGame timer 5
20. [chain] /execute if block -349 6 -42 air if score doubleGameTimer timer matches 6..7 run scoreboard players add doubleGame timer 2
21. [chain] /execute if block -349 6 -42 air if score doubleGameTimer timer matches 8..10 run scoreboard players add doubleGame timer 1
22. [chain] /execute if score doubleGame timer matches 10.. run scoreboard players add doubleGameFlip timer 1
23. [chain] /execute if score doubleGame timer matches 10.. run scoreboard players add doubleGameTimer timer 1
24. [chain] /execute if score doubleGame timer matches 10.. run scoreboard players set doubleGame timer 0

Row 8

25. [repeat] /execute as @a[tag=doubleBet] at @s if score doubleGameFlip timer matches 1 run playsound minecraft:block.stone_button.click_on ambient @a ~ ~ ~ 10 1
26. [chain] /execute if score doubleGameFlip timer matches 1 store result score doubleGame random run random value 1..2
27. [chain] /execute if score doubleGame random matches 1 run item replace block -349 4 -41 container.13 with minecraft:ender_pearl[minecraft:custom_name="HEADS"]
28. [chain] /execute if score doubleGame random matches 2 run item replace block -349 4 -41 container.13 with minecraft:ender_eye[minecraft:custom_name="TAILS"]
29. [chain] /scoreboard players reset doubleGameFlip timer

Row 9

30. [repeat] /execute as @a[tag=doubleBet] at @s unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. unless score @s random = doubleGame random run scoreboard players set @s bet 0
31. [chain] /execute as @a[tag=doubleBet] at @s unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. unless score @s random = doubleGame random run tellraw @s "<DOUBLE OR NOTHING> YOU LOST! GET LOST!"
32. [chain] /execute as @a[tag=doubleBet] at @s unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. unless score @s random = doubleGame random run tag @s remove doubleBet
33. [chain] /execute as @a[tag=doubleBet] at @s unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. if score @s random = doubleGame random run scoreboard players operation @s bet *= doubleGame bet
34. [chain] /execute as @a[tag=doubleBet] at @s unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. if score @s random = doubleGame random run tellraw @s ["<DOUBLE OR NOTHING> You WON! You have ", {"score":{"name":"@s","objective":"bet"}}, " diamonds! Do you want to DOUBLE OR NOTHING???"]
35. [chain] /execute as @a[tag=doubleBet] at @s unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. if score @s random = doubleGame random run playsound minecraft:entity.firework_rocket.launch ambient @s
36. [chain] /execute unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. run setblock -349 6 -42 minecraft:oak_button
37. [chain] /execute unless score doubleGameFlip timer matches 0..2 if score doubleGameTimer timer matches 11.. run scoreboard players reset doubleGameTimer timer

Row 10

38. [repeat] /execute as @a[tag=doubleBet] at @s if score @s bet matches 1.. if block -351 6 -41 minecraft:mangrove_button[powered=true] run tag @s add doubleCashOut
39. [chain] /execute as @a[tag=doubleBet] at @s if score @s bet matches 1.. if block -351 6 -41 minecraft:mangrove_button[powered=true] run tag @s remove doubleBet
40. [chain] /execute as @a[tag=doubleCashOut] at @s if score @s bet matches 1.. run summon item ~ ~10 ~ {Item:{id:"minecraft:diamond",count:1}}
41. [chain] /execute as @a[tag=doubleCashOut] at @s if score @s bet matches 1.. run scoreboard players remove @s bet 1
42. [chain] /execute as @a[tag=doubleCashOut] at @s if score @s bet matches 0 run tag @s remove doubleCashOut

Preview

impulse
impulse
impulse
impulse
repeat
chain
chain
chain
chain
chain
chain
chain
chain
chain
repeat
chain
repeat
chain
chain
chain
chain
chain
chain
chain
repeat
chain
chain
chain
chain
repeat
chain
chain
chain
chain
chain
chain
chain
repeat
chain
chain
chain
chain

Video

Too lazy to copy and paste each command?