XxWallProtectionxX Legacy
Key RequiredUniversal

XxWallProtectionxX Legacy

Universal ScriptXxLemon_WolfyxXXxLemon_WolfyxX 1.9K views 295 executesUpdated May 13, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•135 lines (4196 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local localPlayer = Players.LocalPlayer
local mouse = localPlayer:GetMouse()

local targetPlayer = nil
local connection = nil

local FOLLOW_DISTANCE = 1.0     -- How close do you want to be to the back of the player..
local STOP_DISTANCE = 0.6 -- Stop where exactly it is.
local MAX_SPEED = 16 -- how fast can you follow to the player

local function stopFollowing()
    targetPlayer = nil
    if connection then
        connection:Disconnect()
        connection = nil
    end
    
    local char = localPlayer.Character
    if char then
        local hum = char:FindFirstChild("Humanoid")
        local root = char:FindFirstChild("HumanoidRootPart")
        if hum then
            hum.PlatformStand = false
            hum.WalkSpeed = 16
        end
        if root then
            root.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
        end
    end
end

local function startFollowing(target)
    targetPlayer = target
    if connection then connection:Disconnect() end
    
    connection = RunService.Heartbeat:Connect(function()
        local myChar = localPlayer.Character
        local targetChar = targetPlayer.Character
        
        if not myChar or not targetChar then
            stopFollowing()
            return
        end
        
        local myRoot = myChar:FindFirstChild("HumanoidRootPart")
        local targetRoot = targetChar:FindFirstChild("HumanoidRootPart")
        local myHum = myChar:FindFirstChild("Humanoid")
        
        if not myRoot or not targetRoot or not myHum then
            stopFollowing()
            return
        end
        
        myHum.PlatformStand = false
        myHum.WalkSpeed = 16
        
        -- Precise position: Exactly 1 stud behind
        local behindCFrame = targetRoot.CFrame * CFrame.new(0, 0, FOLLOW_DISTANCE)
        local targetPos = behindCFrame.Position
        
        local currentPos = myRoot.Position
        local direction = (targetPos - currentPos)
        local distance = direction.Magnitude
        
        -- Smooth movement
        if distance > STOP_DISTANCE then
            local moveDir = direction.Unit
            local speed = math.min(distance * 11, MAX_SPEED)
            local desiredVel = moveDir * speed
            
            myRoot.AssemblyLinearVelocity = Vector3.new(desiredVel.X, myRoot.AssemblyLinearVelocity.Y, desiredVel.Z)
        else
            myRoot.AssemblyLinearVelocity = Vector3.new(0, myRoot.AssemblyLinearVelocity.Y, 0)
        end
        
        -- === Facing Logic ===
        if distance > 7 then
            -- Look at player while approaching
            myRoot.CFrame = CFrame.lookAt(currentPos, targetRoot.Position)
        else
            -- When close (1 stud behind): Face AWAY from the player
            local desiredLook = -targetRoot.CFrame.LookVector
            local currentLook = myRoot.CFrame.LookVector
            local newLook = currentLook:Lerp(desiredLook, 0.15)   -- Smooth turn
            
            myRoot.CFrame = CFrame.lookAt(currentPos, currentPos + newLook)
        end
    end)
end

-- Mouse Click Handler
mouse.Button1Down:Connect(function()
    local target = mouse.Target
    if not target then
        stopFollowing()
        return
    end
    
    local character = target.Parent
    if not character then
        stopFollowing()
        return
    end
    
    local player = Players:GetPlayerFromCharacter(character)
    
    if player and player ~= localPlayer then
        if targetPlayer == player then
            stopFollowing()
            print("Stopped following")
        else
            startFollowing(player)
            print("Following: " .. player.Name .. " (1 stud behind)")
        end
    else
        stopFollowing()
        print("Stopped following")
    end
end)

-- Safety
Players.PlayerRemoving:Connect(function(plr)
    if plr == targetPlayer then stopFollowing() end
end)

UserInputService.InputBegan:Connect(function(input, gp)
    if gp then return end
    if input.KeyCode == Enum.KeyCode.F then
        stopFollowing()
    end
end)

Features & Information

WELCOME to teh new script! This one is entirely made for fun, and require no keybinds. - - - Instructions: Just click some player to protect their back from W+S (BACKSHOTS) Click that same player or someone else to stop following and protecting.

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts