Trouble creating a function to /transfer players to a different server

I've created a function with the simple code transfer 0.0.0.0 25565, also tried adding @s at the end. I obviously can't get the function to run on my singleplayer world, but I have a creative superflat that also won't load the function. I can run the exact same command in-game with no issues. Any thoughts?

Continue to help post