What is wrong with my command?
I am trying to do a 1 person sleep command in my realms, and my code won't work for one specific line:
execute if entity @a[scores={KickBed=1..,}] run execute if score @a[scores={sleep=1..,}] run tellraw @a {"text":"","extra":[{"selector":"@p[scores={KickBed=1,}]","color":"white"},{"text":" doesn't want to skip the night!","color":"red"}]}
Here is where I got the command from. All the code after the “run” in the code turned red after I entered it into command blocks.
I know what the problem is!
execute
if entity @a[scores={KickBed=1..}]
if score @a[scores={sleep=1..}]
run tellraw @a {"text":"","extra":[{"selector":"@p[scores={KickBed=1,}]","color":"white"},{"text":" doesn't want to skip the night!","color":"red"}]}
The mistake is that the second if score
argument needs to be if entity
.
Fixed command:
execute if entity @a[scores={KickBed=1..}] if score @a[scores={sleep=1..}] run tellraw @a {"text":"","extra":[{"selector":"@p[scores={KickBed=1,}]","color":"white"},{"text":" doesn't want to skip the night!","color":"red"}]}