
Key RequiredUniversal

-- SERVICES
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local LocalPlayer = Players.LocalPlayer
-- CHARACTER FUNCTION
local function getCharacter()
return LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
end
-- GUI
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "FollowGui"
ScreenGui.ResetOnSpawn = false
ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
local Frame = Instance.new("Frame")
Frame.Size = UDim2.new(0, 200, 0, 70)
Frame.Position = UDim2.new(0.5, -100, 0.5, -35)
Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
Frame.BorderSizePixel = 0
Frame.Active = true
Frame.Draggable = true
Frame.Parent = ScreenGui
local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(0, 12)
UICorner.Parent = Frame
local Button = Instance.new("TextButton")
Button.Size = UDim2.new(1, -10, 1, -10)
Button.Position = UDim2.new(0, 5, 0, 5)
Button.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
Button.TextColor3 = Color3.fromRGB(255, 255, 255)
Button.Text = "Toggle"
Button.Font = Enum.Font.GothamBold
Button.TextSize = 16
Button.BorderSizePixel = 0
Button.Parent = Frame
local ButtonCorner = Instance.new("UICorner")
ButtonCorner.CornerRadius = UDim.new(0, 10)
ButtonCorner.Parent = Button
-- VARIABLES
local following = false
local targetModel = nil
local followConnection = nil
local BACK_DISTANCE = 4
-- CHECK VALID HUMANOID MODEL
local function isValidTarget(model)
return model
and model:IsA("Model")
and model:FindFirstChild("Humanoid")
and model:FindFirstChild("HumanoidRootPart")
and model ~= getCharacter()
end
-- GET ALL POSSIBLE TARGETS (PLAYERS + DUMMIES)
local function getAllTargets()
local targets = {}
-- Players
for _, plr in pairs(Players:GetPlayers()) do
if plr ~= LocalPlayer and plr.Character then
table.insert(targets, plr.Character)
end
end
-- NPCs / Dummies
for _, obj in pairs(Workspace:GetChildren()) do
if isValidTarget(obj) then
table.insert(targets, obj)
end
end
return targets
end
-- FIND NEAREST TARGET (NO LIMIT)
local function getNearestTarget()
local char = getCharacter()
local hrp = char:FindFirstChild("HumanoidRootPart")
if not hrp then return nil end
local closest
local shortest = math.huge
for _, model in pairs(getAllTargets()) do
if isValidTarget(model) then
local dist = (model.HumanoidRootPart.Position - hrp.Position).Magnitude
if dist < shortest then
shortest = dist
closest = model
end
end
end
return closest
end
-- STOP FOLLOW
local function stopFollow()
following = false
targetModel = nil
if followConnection then
followConnection:Disconnect()
followConnection = nil
end
Button.Text = "Toggle (OFF)"
end
-- START FOLLOW
local function startFollow()
targetModel = getNearestTarget()
if not targetModel then return end
following = true
Button.Text = "Toggle (ON)"
followConnection = RunService.Heartbeat:Connect(function()
if not following then return end
local char = getCharacter()
local hrp = char:FindFirstChild("HumanoidRootPart")
if not hrp or not isValidTarget(targetModel) then
targetModel = getNearestTarget()
return
end
local targetHRP = targetModel.HumanoidRootPart
-- BACK OF TARGET
local backPos =
targetHRP.Position
- (targetHRP.CFrame.LookVector * BACK_DISTANCE)
hrp.CFrame = CFrame.new(backPos, targetHRP.Position)
end)
end
-- BUTTON CLICK
Button.MouseButton1Click:Connect(function()
if following then
stopFollow()
else
startFollow()
end
end)
-- AUTO RE-FOLLOW AFTER RESET
LocalPlayer.CharacterAdded:Connect(function()
task.wait(1)
if following then
startFollow()
end
end)



Some moveset it's will been glitches