$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 ~ ~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 block.note_block.pling master @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~ 500 2 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 block.note_block.pling master @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~ 500 2 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}] "§7[§r§6§lBetter §r§7§lHappy Ghast§r§7] §aDisplayed particules and played sound at the selected Happy Ghast for you."
$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}] ["§7[§r§6§lBetter §r§7§lHappy Ghast§r§7] §aDisplayed particules and played sound at the selected Happy Ghast named \"",{selector:"@e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}]"},"§a\" for you."]
$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}] "§7[§r§6§lBetter §r§7§lHappy Ghast§r§7] §cNo selected Happy Ghast as been 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 block.note_block.pling master @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~ 1 0.5