$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}] ["§8[§bSky Deck§8] ",{selector:"@e[limit=1,nbt={UUID:$(to_dismount)}]"}," §awas dismounted."]
$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}] ["§8[§bSky Deck§8] ",{selector:"@e[limit=1,nbt={UUID:$(to_dismount)}]"}," §awas dismounted from 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 ui @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}] "§8[§bSky Deck§8] §cThere are no other passengers to dismount."
$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}] ["§8[§bSky Deck§8] §cNo other passengers found on 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 ui @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}] "§8[§bSky Deck§8] §cNo selected Happy Ghast was found."
$execute 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