Universal Script 📌
3.0k Views
7 Executions

teleport to a random player

Universal Script 📌
axzonenow123
axzonenow123First script
2 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

teleport to a random person pretty simple long script btw

Updates

  1. Script edited: Create script

View Raw
-- 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


Comments

1
Log in to join the conversation. Login
axzonenow123's profile picture
axzonenow123Uploader2 years ago(edited)

pretty trash LMAO

1