scoreboard players tag @a[tag=!InPig,score_InPig_min=1] add InPig
scoreboard players tag @a[score_InPig_min=1] add ResetInPig {OnGround:1b}
scoreboard players reset @a[tag=ResetInPig] InPig
scoreboard players tag @a[tag=ResetInPig] remove InPig
scoreboard players tag @a[tag=ResetInPig] remove ResetInPig