Universal tp
Key RequiredUniversal

Universal tp

Universal Scriptjijisumm183jijisumm183 3.8K views 1.1K executesUpdated Jan 27, 2025
Unrated
00
Lua Script•252 lines (8138 chars)
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local gui = Instance.new("ScreenGui")
gui.Name = "TeleportGUI"
gui.ResetOnSpawn = false

-- Main Frame
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.new(0.5, 0, 0, 180)
mainFrame.Position = UDim2.new(0.5, 0, 0.35, 0)
mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
mainFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
mainFrame.BackgroundTransparency = 0.1
mainFrame.BorderSizePixel = 0
mainFrame.ClipsDescendants = true
mainFrame.Parent = gui

-- Title Bar (Drag Handle)
local titleBar = Instance.new("TextLabel")
titleBar.Name = "TitleBar"
titleBar.Size = UDim2.new(1, 0, 0, 30)
titleBar.Position = UDim2.new(0, 0, 0, 0)
titleBar.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
titleBar.Text = "  Teleport GUI"
titleBar.TextColor3 = Color3.new(1, 1, 1)
titleBar.TextScaled = true
titleBar.TextXAlignment = Enum.TextXAlignment.Left
titleBar.Font = Enum.Font.GothamBold
titleBar.Parent = mainFrame

-- Control Buttons Container
local buttonContainer = Instance.new("Frame")
buttonContainer.Name = "ButtonContainer"
buttonContainer.Size = UDim2.new(0.2, 0, 1, 0)
buttonContainer.Position = UDim2.new(0.8, 0, 0, 0)
buttonContainer.BackgroundTransparency = 1
buttonContainer.Parent = titleBar

-- Minimize Button
local minimizeButton = Instance.new("TextButton")
minimizeButton.Name = "MinimizeButton"
minimizeButton.Size = UDim2.new(0.5, 0, 1, 0)
minimizeButton.Position = UDim2.new(0, 0, 0, 0)
minimizeButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
minimizeButton.Text = "-"
minimizeButton.TextColor3 = Color3.new(1, 1, 1)
minimizeButton.TextScaled = true
minimizeButton.Font = Enum.Font.GothamBold
minimizeButton.Parent = buttonContainer

-- Close Button
local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Size = UDim2.new(0.5, 0, 1, 0)
closeButton.Position = UDim2.new(0.5, 0, 0, 0)
closeButton.BackgroundColor3 = Color3.fromRGB(255, 50, 50)
closeButton.Text = "X"
closeButton.TextColor3 = Color3.new(1, 1, 1)
closeButton.TextScaled = true
closeButton.Font = Enum.Font.GothamBold
closeButton.Parent = buttonContainer

-- Content Frame
local contentFrame = Instance.new("Frame")
contentFrame.Name = "ContentFrame"
contentFrame.Size = UDim2.new(1, 0, 1, -30)
contentFrame.Position = UDim2.new(0, 0, 0, 30)
contentFrame.BackgroundTransparency = 1
contentFrame.Parent = mainFrame

-- Input Box
local inputBox = Instance.new("TextBox")
inputBox.Name = "InputBox"
inputBox.Size = UDim2.new(0.9, 0, 0.2, 0)
inputBox.Position = UDim2.new(0.05, 0, 0.15, 0)
inputBox.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
inputBox.PlaceholderText = "Enter name or 'random'"
inputBox.Text = ""
inputBox.TextColor3 = Color3.new(1, 1, 1)
inputBox.TextScaled = true
inputBox.ClearTextOnFocus = false
inputBox.Parent = contentFrame

-- Teleport Button
local teleportButton = Instance.new("TextButton")
teleportButton.Name = "TeleportButton"
teleportButton.Size = UDim2.new(0.9, 0, 0.2, 0)
teleportButton.Position = UDim2.new(0.05, 0, 0.4, 0)
teleportButton.BackgroundColor3 = Color3.fromRGB(80, 80, 255)
teleportButton.Text = "TELEPORT"
teleportButton.TextColor3 = Color3.new(1, 1, 1)
teleportButton.TextScaled = true
teleportButton.Font = Enum.Font.GothamBold
teleportButton.Parent = contentFrame

-- Status Message
local statusMessage = Instance.new("TextLabel")
statusMessage.Name = "StatusMessage"
statusMessage.Size = UDim2.new(0.9, 0, 0.2, 0)
statusMessage.Position = UDim2.new(0.05, 0, 0.65, 0)
statusMessage.BackgroundTransparency = 1
statusMessage.Text = ""
statusMessage.TextColor3 = Color3.new(1, 1, 1)
statusMessage.TextScaled = true
statusMessage.Font = Enum.Font.Gotham
statusMessage.Parent = contentFrame

-- Dragging functionality
local dragging, dragInput, dragStart, startPos
local isMinimized = false
local originalSize = mainFrame.Size
local minimizedSize = UDim2.new(mainFrame.Size.X.Scale, 0, 0, 30)

local function updateStatus(text)
    statusMessage.Text = text
    task.wait(2)
    statusMessage.Text = ""
end

local function teleportToPlayer(targetPlayer)
    if targetPlayer and targetPlayer.Character then
        local humanoidRootPart = targetPlayer.Character:FindFirstChild("HumanoidRootPart")
        local localChar = player.Character
        local localRoot = localChar and localChar:FindFirstChild("HumanoidRootPart")
        
        if humanoidRootPart and localRoot then
            localRoot.CFrame = humanoidRootPart.CFrame
            updateStatus("Teleported to "..targetPlayer.DisplayName)
        else
            updateStatus("Target not available")
        end
    else
        updateStatus("Player not found")
    end
end

local function findBestMatch(searchTerm)
    local allPlayers = Players:GetPlayers()
    local matches = {}
    
    if string.lower(searchTerm) == "random" then
        local validPlayers = {}
        for _, p in ipairs(allPlayers) do
            if p ~= player then table.insert(validPlayers, p) end
        end
        if #validPlayers > 0 then
            return validPlayers[math.random(#validPlayers)]
        end
        return nil
    end
    
    searchTerm = string.lower(searchTerm)
    
    for _, p in ipairs(allPlayers) do
        if p ~= player then
            local displayLower = string.lower(p.DisplayName)
            local nameLower = string.lower(p.Name)
            
            local displayPos = string.find(displayLower, searchTerm, 1, true)
            local namePos = string.find(nameLower, searchTerm, 1, true)
            
            local earliestPos = math.huge
            if displayPos then earliestPos = math.min(earliestPos, displayPos) end
            if namePos then earliestPos = math.min(earliestPos, namePos) end
            
            if earliestPos ~= math.huge then
                table.insert(matches, {
                    player = p,
                    pos = earliestPos,
                    length = math.min(#displayLower, #nameLower)
                })
            end
        end
    end
    
    if #matches > 0 then
        table.sort(matches, function(a, b)
            if a.pos == b.pos then
                return a.length < b.length
            end
            return a.pos < b.pos
        end)
        return matches[1].player
    end
    
    return nil
end

-- Minimize functionality
minimizeButton.Activated:Connect(function()
    isMinimized = not isMinimized
    mainFrame.Size = isMinimized and minimizedSize or originalSize
    minimizeButton.Text = isMinimized and "+" or "-"
    contentFrame.Visible = not isMinimized
    minimizeButton.BackgroundColor3 = isMinimized 
        and Color3.fromRGB(255, 50, 50)
        or Color3.fromRGB(200, 50, 50)
end)

-- Close functionality
closeButton.Activated:Connect(function()
    gui:Destroy()
end)

-- Teleport functionality
teleportButton.Activated:Connect(function()
    local searchText = inputBox.Text
    if searchText == "" then return end
    
    local target = findBestMatch(searchText)
    if target then
        teleportToPlayer(target)
    else
        updateStatus("No matching players found")
    end
end)

-- Dragging functionality
titleBar.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch then
        dragging = true
        dragStart = input.Position
        startPos = mainFrame.Position
        
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then
                dragging = false
            end
        end)
    end
end)

titleBar.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch then
        dragInput = input
    end
end)

game:GetService("UserInputService").InputChanged:Connect(function(input)
    if dragging and input == dragInput then
        local delta = input.Position - dragStart
        mainFrame.Position = UDim2.new(
            startPos.X.Scale,
            startPos.X.Offset + delta.X,
            startPos.Y.Scale,
            startPos.Y.Offset + delta.Y
        )
    end
end)

gui.Parent = player:WaitForChild("PlayerGui")

Features & Information

Universal tp script made by me

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts