$execute if entity @e[limit=1,nbt={UUID:$(to_dismount)}] run tag @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},predicate=better_happy_ghast:have_any_passengers,tag=!Happy_Ghast.Is_Dismounting_One_Time] add Happy_Ghast.Is_Dismounting_One_Time

$execute if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},tag=Happy_Ghast.Is_Dismounting_One_Time,predicate=better_happy_ghast:have_any_passengers] 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] ",{selector:"@e[limit=1,nbt={UUID:$(to_dismount)}]"}," §aas been dismounted from the Happy Ghast."]
$execute if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},tag=Happy_Ghast.Is_Dismounting_One_Time,predicate=better_happy_ghast:have_any_passengers] 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] ",{selector:"@e[limit=1,nbt={UUID:$(to_dismount)}]"}," §aas been dismounted from the Happy Ghast named \"",{selector:"@e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},tag=Happy_Ghast.Is_Dismounting_One_Time]"},"§a\"."]
$execute if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},tag=Happy_Ghast.Is_Dismounting_One_Time,predicate=better_happy_ghast:have_any_passengers] run playsound minecraft:block.note_block.snare master @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~

$execute if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},predicate=!better_happy_ghast:have_any_passengers,tag=!Happy_Ghast.Is_Dismounting_One_Time] unless data entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] CustomName unless predicate better_happy_ghast:have_any_passengers run tellraw @a[limit=1,nbt={UUID:$(UUID)},scores={better_happy_ghast.player_configs.send_message=1}] "§7[§r§6§lBetter §r§7§lHappy Ghast§r§7] §cThere is no another entity that is mounted on the Happy Ghast."
$execute if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},predicate=!better_happy_ghast:have_any_passengers,tag=!Happy_Ghast.Is_Dismounting_One_Time] if data entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}}] CustomName unless predicate better_happy_ghast:have_any_passengers run tellraw @a[limit=1,nbt={UUID:$(UUID)},scores={better_happy_ghast.player_configs.send_message=1}] ["§7[§r§6§lBetter §r§7§lHappy Ghast§r§7] §cThere is no another entity that is mounted on the Happy Ghast named \"",{selector:"@e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},tag=!Happy_Ghast.Is_Dismounting_One_Time]"},"§c\"."]
$execute if entity @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},predicate=!better_happy_ghast:have_any_passengers,tag=!Happy_Ghast.Is_Dismounting_One_Time] run playsound minecraft:block.note_block.snare master @s[scores={better_happy_ghast.player_configs.play_sound=1}] ~ ~ ~ 1 0.5

$execute as @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},tag=Happy_Ghast.Is_Dismounting_One_Time] on passengers run ride @e[limit=1,nbt={UUID:$(to_dismount)}] dismount

$tag @e[type=minecraft:happy_ghast,limit=1,nbt={UUID:$(Selected),data:{Owner:$(UUID)}},tag=Happy_Ghast.Is_Dismounting_One_Time] remove Happy_Ghast.Is_Dismounting_One_Time

$execute 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 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