one punchman
Key RequiredUniversal

one punchman

Universal Scriptanok9538anok9538 5.3K views 6.1K executesUpdated Dec 28, 2024
2.5/ 5(2 votes)
1150% Positive
Lua Script•141 lines (5445 chars)
-- Получаем сервисы
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

-- Переменные
local isFollowing = false -- Следует ли за игроком при нажатии X
local isMoving = false -- Следует ли за игроком при удержании C
local targetPlayer = nil -- Целевой игрок
local offset = Vector3.new(0, 0, 3) -- Смещение за спиной игрока
local followSpeed = 100 -- Скорость следования за игроком
local moveSpeed = 100 -- Скорость перемещения к игроку

-- Создание GUI
local screenGui = Instance.new("ScreenGui", player.PlayerGui)
screenGui.Name = "OnePunchManGui"

-- Текст "One Punch Man"
local textLabel = Instance.new("TextLabel", screenGui)
textLabel.Text = "One Punch Man"
textLabel.Font = Enum.Font.Arcade -- Квадратный шрифт
textLabel.TextColor3 = Color3.new(1, 1, 1) -- Белый цвет
textLabel.TextSize = 50 -- Размер текста
textLabel.BackgroundTransparency = 1
textLabel.Size = UDim2.new(0.5, 0, 0.1, 0) -- Размер
textLabel.Position = UDim2.new(0.25, 0, 0.4, 0) -- Центр экрана
textLabel.TextTransparency = 0

-- Анимация исчезновения текста
local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local goal = {TextTransparency = 1}
local tween = TweenService:Create(textLabel, tweenInfo, goal)

tween:Play() -- Запуск анимации

tween.Completed:Connect(function()
    textLabel:Destroy() -- Удаляем текст после анимации
end)

-- Создание кнопки "Перемещение"
local moveButton = Instance.new("TextButton", screenGui)
moveButton.Text = "Перемещение"
moveButton.Font = Enum.Font.SourceSans
moveButton.TextSize = 20
moveButton.Size = UDim2.new(0.2, 0, 0.05, 0)
moveButton.Position = UDim2.new(0.01, 0, 0.1, 0)
moveButton.BackgroundColor3 = Color3.new(0.2, 0.2, 0.8)
moveButton.TextColor3 = Color3.new(1, 1, 1)

-- Создание кнопки "Перемещение 2"
local followButton = Instance.new("TextButton", screenGui)
followButton.Text = "Перемещение 2"
followButton.Font = Enum.Font.SourceSans
followButton.TextSize = 20
followButton.Size = UDim2.new(0.2, 0, 0.05, 0)
followButton.Position = UDim2.new(0.01, 0, 0.2, 0)
followButton.BackgroundColor3 = Color3.new(0.8, 0.2, 0.2)
followButton.TextColor3 = Color3.new(1, 1, 1)

-- Функция для нахождения ближайшего игрока
local function getClosestPlayer()
    local closestPlayer = nil
    local shortestDistance = math.huge

    for _, otherPlayer in pairs(Players:GetPlayers()) do
        if otherPlayer ~= player and otherPlayer.Character and otherPlayer.Character:FindFirstChild("HumanoidRootPart") then
            local otherCharacter = otherPlayer.Character
            local distance = (character.HumanoidRootPart.Position - otherCharacter.HumanoidRootPart.Position).Magnitude
            if distance < shortestDistance then
                shortestDistance = distance
                closestPlayer = otherPlayer
            end
        end
    end

    return closestPlayer
end

-- Функция для перемещения к ближайшему игроку (C)
local function moveToClosestPlayer(deltaTime)
    if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
        local targetPosition = targetPlayer.Character.HumanoidRootPart.Position
        local currentPosition = character.HumanoidRootPart.Position
        local direction = (targetPosition - currentPosition).Unit
        local newPosition = currentPosition + direction * moveSpeed * deltaTime

        character.HumanoidRootPart.CFrame = CFrame.new(newPosition, targetPosition)
    else
        isMoving = false -- Если цель потеряна, останавливаем движение
    end
end

-- Функция для следования за спину игрока (X)
local function followPlayer(deltaTime)
    if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") then
        local targetRootPart = targetPlayer.Character.HumanoidRootPart
        local targetPosition = targetRootPart.Position - targetRootPart.CFrame.LookVector * offset.Z
        local currentPosition = character.HumanoidRootPart.Position
        local direction = (targetPosition - currentPosition).Unit
        local newPosition = currentPosition + direction * followSpeed * deltaTime

        character.HumanoidRootPart.CFrame = CFrame.new(newPosition, targetRootPart.Position)
    else
        isFollowing = false -- Если цель потеряна, останавливаем следование
    end
end

-- Логика кнопки "Перемещение"
moveButton.MouseButton1Click:Connect(function()
    targetPlayer = getClosestPlayer()
    if targetPlayer then
        isMoving = not isMoving
        print(isMoving and "Перемещение включено." or "Перемещение выключено.")
    else
        print("Рядом нет игроков для перемещения.")
    end
end)

-- Логика кнопки "Перемещение 2"
followButton.MouseButton1Click:Connect(function()
    targetPlayer = getClosestPlayer()
    if targetPlayer then
        isFollowing = not isFollowing
        print(isFollowing and "Следование включено." or "Следование выключено.")
    else
        print("Рядом нет игроков для следования.")
    end
end)

-- Цикл обновления движения
RunService.Heartbeat:Connect(function(deltaTime)
    if isMoving then
        moveToClosestPlayer(deltaTime)
    end
    if isFollowing then
        followPlayer(deltaTime)
    end
end)

Features & Information

скрипт перемащает игрока за спину 2 игрока момент из one punch man приятной игры можно использовать в других играх есть 2 вида перемищения 1 на X 2 на C

Community Comments (2)

ScriptDLC_MultiScriptDLC_MultiDec 29, 2024(edited)

ChatGPT Moment

anok9538anok9538Dec 29, 2024(edited)

yes

More Scripts for Universal Scripts