You would have to teleport the player rather than setting their location. The correct syntax for teleporting would be:
teleport player to location(x, y, z, world("world"))
There is also a yaw & pitch option within the location function (the location function is the location(stuff)), yaw & pitch is used to set a player's direction, to use it, replace the location above with location(x, y, z, world("world"), 0.01, 0.01).