Key Press to Teleport

Where to put the code

Code

local UserInputService = game:GetService("UserInputService")
 
local function onInputBegan(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.T then
        local player = game.Players.LocalPlayer
        player.Character.HumanoidRootPart.CFrame = CFrame.new(x, y, z)
    end
end
 
UserInputService.InputBegan:Connect(onInputBegan)

Teleport Region

local telePart = game.Workspace.telePart
local UserInputService = game:GetService("UserInputService")

local function teleRegion()
    local x = telePart.Position.X
    local z = telePart.Position.Z
    local size = telePart.Size.X
    local player = game.Players.LocalPlayer
    local playerPos = player.Character.HumanoidRootPart.Position
 
    if playerPos.X > (x - size) and playerPos.X < (x + size) then
        if playerPos.Z > (z - size) and playerPos.Z < (z + size) then
            return true
        end
    end
end

local function onInputBegan(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.T and teleRegion() then
        local player = game.Players.LocalPlayer
        player.Character.HumanoidRootPart.CFrame = CFrame.new(25.91, 5, -35.39)
    end
end

 
UserInputService.InputBegan:Connect(onInputBegan)