Using the Roblox Luau language, how would I make a script that finds the nearest character to me, then teleports me to that character? Make a separate function for getting the nearest character and then incorporate it into the main code.
Here is the code for finding the nearest character:

```
function findNearestCharacter()
    local characters = game.Workspace:GetChildren()
    local myPos = game.Players.LocalPlayer.Character.PrimaryPart.Position
    local nearestCharacter = nil
    local nearestDistance = math.huge

    for i, character in pairs(characters) do
        if character:IsA(Model) and character ~= game.Players.LocalPlayer.Character then
            local distance = (character.PrimaryPart.Position - myPos).Magnitude
            if distance < nearestDistance then
                nearestCharacter = character
                nearestDistance = distance
            end
        end
    end

    return nearestCharacter
end

```

And here is the main code that uses the `findNearestCharacter` function to teleport the player to the nearest character:

```
local nearestCharacter = findNearestCharacter()

if nearestCharacter then
    game.Players.LocalPlayer.Character.PrimaryPart.CFrame = nearestCharacter.PrimaryPart.CFrame
end

```
that answer looks convoluted, is there an easier script?