dialog clear @s[scores={happy_ghast=3}]

$data modify entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] data.FixedPos.x set from entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] Pos[0]
$data modify entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] data.FixedPos.y set from entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] Pos[1]
$data modify entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] data.FixedPos.z set from entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] Pos[2]
scoreboard players set @s better_happy_ghast.selected_happy_ghast.particles.time 20
$execute at @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] run particle minecraft:flash{color:[0.9,0.9,0.9,1]} ~ ~1.5 ~ 1.5 1.5 1.5 0 40 force @s
$execute if score @s happy_ghast matches 3 at @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] run playsound minecraft:block.amethyst_block.chime ui @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~ 500 1.5 1
$execute unless score @s happy_ghast matches 3 at @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},distance=..100] run playsound minecraft:block.amethyst_block.chime ui @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~ 500 1.5 1
$execute if score @s happy_ghast matches 3 if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] unless data entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] CustomName run tellraw @s[scores={better_happy_ghast.player_configs.send_message=1}] "§8[§bSky Deck§8] §aHighlighted your selected Happy Ghast."
$execute if score @s happy_ghast matches 3 if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] if data entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] CustomName run tellraw @s[scores={better_happy_ghast.player_configs.send_message=1}] ["§8[§bSky Deck§8] §aHighlighted selected Happy Ghast named \"",{selector:"@e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}]"},"§a\"."]
$execute if score @s happy_ghast matches 3 unless entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] run tellraw @s[scores={better_happy_ghast.player_configs.send_message=1}] "§8[§bSky Deck§8] §cNo selected Happy Ghast was found."
$execute if score @s happy_ghast matches 3 unless entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] run playsound minecraft:block.amethyst_block.step ui @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~ 1 0.8