
KeylessUniversal

-- LocalScript inside StarterPlayerScripts or StarterCharacterScripts
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local LocalPlayer = Players.LocalPlayer
-- Function to create a red box highlight effect on a part
local function createBoxHighlight(target)
-- Remove any existing box highlight to prevent stacking
local existing = target:FindFirstChild("PlayerBoxHighlight")
if existing then existing:Destroy() end
local box = Instance.new("BoxHandleAdornment")
box.Name = "PlayerBoxHighlight"
box.Size = target.Size + Vector3.new(0.1, 0.1, 0.1) -- Slightly larger to avoid clipping
box.AlwaysOnTop = true
box.ZIndex = 5
box.Adornee = target
box.Color3 = Color3.fromRGB(255, 0, 0) -- Red
box.Transparency = 0.5
box.Parent = target
end
-- Function to create a line pointing from LocalPlayer to target player
local function createPointerLine(targetCharacter)
local targetTorso = targetCharacter:WaitForChild("HumanoidRootPart", 5)
if not targetTorso then return end
-- Get LocalPlayer's torso
local localCharacter = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local localTorso = localCharacter:WaitForChild("HumanoidRootPart", 5)
if not localTorso then return end
-- Clean up old lines or attachments on this target
local oldAttachment = targetTorso:FindFirstChild("TargetLineAttachment")
if oldAttachment then oldAttachment:Destroy() end
local oldBeam = targetTorso:FindFirstChild("PointerBeam")
if oldBeam then oldBeam:Destroy() end
-- Create attachment on LocalPlayer's torso if it doesn't exist
local localAttachment = localTorso:FindFirstChild("LocalLineAttachment")
if not localAttachment then
localAttachment = Instance.new("Attachment")
localAttachment.Name = "LocalLineAttachment"
localAttachment.Parent = localTorso
end
-- Create attachment on the Target Player's torso
local targetAttachment = Instance.new("Attachment")
targetAttachment.Name = "TargetLineAttachment"
targetAttachment.Parent = targetTorso
-- Create the Beam (Line)
local beam = Instance.new("Beam")
beam.Name = "PointerBeam"
beam.Attachment0 = localAttachment
beam.Attachment1 = targetAttachment
beam.Color = ColorSequence.new(Color3.fromRGB(255, 0, 0)) -- Red line
beam.Width0 = 0.1 -- Starting thickness
beam.Width1 = 0.1 -- Ending thickness
beam.FaceCamera = true
beam.LightEmission = 1
beam.AlwaysOnTop = true -- Makes line visible through walls
beam.Parent = targetTorso
end
-- Function to handle a character setup
local function setupCharacter(character)
-- Wait for the humanoid and essential parts to load completely
local humanoid = character:WaitForChild("Humanoid", 10)
if not humanoid then return end
task.wait(0.5) -- Safe delay for accessory/part physics replication
-- Highlight all BaseParts
for _, part in ipairs(character:GetChildren()) do
if part:IsA("BasePart") then
createBoxHighlight(part)
end
end
-- Create tracking line
createPointerLine(character)
end
-- Monitor a player
local function watchPlayer(player)
if player == LocalPlayer then return end
-- Setup existing character if available
if player.Character then
task.spawn(setupCharacter, player.Character)
end
-- Setup future characters on respawn
player.CharacterAdded:Connect(function(character)
setupCharacter(character)
end)
end
-- Watch all current players in the server
for _, player in ipairs(Players:GetPlayers()) do
watchPlayer(player)
end
-- Watch incoming players
Players.PlayerAdded:Connect(watchPlayer)
-- Re-link lines if the LocalPlayer dies and respawns
LocalPlayer.CharacterAdded:Connect(function()
task.wait(1) -- Wait for local torso to exist
for _, player in ipairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character then
createPointerLine(player.Character)
end
end
end)No comments yet for this script.



