teleport to a random player
Key RequiredUniversal

teleport to a random player

Universal Scriptaxzonenow123axzonenow123 3K views 3 executesUpdated Feb 17, 2025
Unrated
00
Lua Script•41 lines (1602 chars)
-- Teleport to another player script

local player = game.Players.LocalPlayer
local userInputService = game:GetService("UserInputService")
local teleportKey = Enum.KeyCode.T -- Key to trigger teleport (T key)
local targetPlayer -- Variable to store the player to teleport to

-- Function to teleport the player to the target player's position
local function teleportToPlayer(targetPlayer)
    if targetPlayer and targetPlayer.Character then
        local targetHumanoidRootPart = targetPlayer.Character:WaitForChild("HumanoidRootPart")
        local teleportPosition = targetHumanoidRootPart.Position
        player.Character:SetPrimaryPartCFrame(CFrame.new(teleportPosition))
    end
end

-- Function to select a target player to teleport to
local function selectTargetPlayer()
    -- Display a list of players in the game and allow selection (optional)
    -- For now, we simply set the target player to the first player other than yourself
    for _, otherPlayer in pairs(game.Players:GetPlayers()) do
        if otherPlayer ~= player then
            targetPlayer = otherPlayer
            break
        end
    end
end

-- Detect when the player presses the teleport key (T)
userInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.UserInputType == Enum.UserInputType.Keyboard then
        if input.KeyCode == teleportKey then
            -- Select target player and teleport to them
            selectTargetPlayer()
            if targetPlayer then
                teleportToPlayer(targetPlayer)
            end
        end
    end
end)

Features & Information

teleport to a random person pretty simple long script btw

Community Comments (1)

axzonenow123axzonenow123Feb 17, 2025(edited)

pretty trash LMAO

More Scripts for Universal Scripts