So, this game, people spawn under the map sometimes, and the game datastores their location so they rapidly die, I want to teleport the user up above the map, except how do I know how far on the Y axis I teleport them up?
Use SpawnLocations or pre-placed parts, and set the character’s position to that.
To detect the highest floor is you could raycast from a given height above the player and towards the player’s position. Then, find the first solid floor.
What about the last floor, say there was like a mountain what if I want the top
That’s why you raycast above the character to the character: the first objects you would find would be the furthest up. It can be detrimental to performance if the raycast would be very long, assuming you have a very vertical world.