Player doesn't teleport with dimension change advancement when going through end portal

I have an advancement checking for a dimension change to the end dimension. That advancement then call a function that teleports the player, although while the function does run they are not teleported and still spawn on the end obsidian platform.

Also, interestingly, if I try to reset the advancement in that same function it freaks out and crashes the game (pretty sure it gets stuck looping through the advancement and function every tick).

Any ideas whats happening?

Continue to help post