Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local LocalPlayer = Players.LocalPlayer
- -----------------------------------------------------------
- -- SETTINGS
- -----------------------------------------------------------
- local ARROW_DISTANCE = 21
- -- LINE VISIBILITY (dark & thick)
- local COLOR_DARK = Color3.fromRGB(20, 0, 0) -- almost black red
- local WIDTH_START = 2.4 -- near head
- local WIDTH_END = 0.3 -- far end
- -----------------------------------------------------------
- function createDirectionalESP(character)
- local head = character:WaitForChild("Head")
- local humanoid = character:WaitForChild("Humanoid")
- local root = character:WaitForChild("HumanoidRootPart")
- -----------------------------------------------------------
- -- Attachments
- -----------------------------------------------------------
- local att1 = Instance.new("Attachment")
- att1.Name = "DirESP_Head"
- att1.Parent = head
- local att2 = Instance.new("Attachment")
- att2.Name = "DirESP_End"
- att2.Parent = head
- -----------------------------------------------------------
- -- Beam (AIM LINE)
- -----------------------------------------------------------
- local beam = Instance.new("Beam")
- beam.Name = "DirectionalBeam"
- -- DARK / SOLID
- beam.Color = ColorSequence.new(COLOR_DARK)
- beam.Transparency = NumberSequence.new(0)
- -- THICK
- beam.Width0 = WIDTH_START
- beam.Width1 = WIDTH_END
- -- IGNORE LIGHTING
- beam.LightEmission = 0
- beam.LightInfluence = 0
- -- ALWAYS VISIBLE
- beam.FaceCamera = true
- beam.ZOffset = -2
- beam.Attachment0 = att1
- beam.Attachment1 = att2
- beam.Parent = head
- -----------------------------------------------------------
- -- Freeze direction while jumping
- -----------------------------------------------------------
- local frozenDir
- local isFrozen = false
- humanoid.StateChanged:Connect(function(_, newState)
- if newState == Enum.HumanoidStateType.Jumping then
- local look = root.CFrame.LookVector
- frozenDir = Vector3.new(look.X, 0, look.Z).Unit
- isFrozen = true
- elseif newState == Enum.HumanoidStateType.Landed then
- isFrozen = false
- end
- end)
- -----------------------------------------------------------
- -- Update loop
- -----------------------------------------------------------
- RunService.RenderStepped:Connect(function()
- if not character.Parent then return end
- local dir
- if isFrozen and frozenDir then
- dir = frozenDir
- else
- local look = root.CFrame.LookVector
- dir = Vector3.new(look.X, 0, look.Z).Unit
- end
- att2.WorldPosition = head.Position + dir * ARROW_DISTANCE
- end)
- end
- -----------------------------------------------------------
- -- Apply ESP to all non-local players
- -----------------------------------------------------------
- Players.PlayerAdded:Connect(function(plr)
- if plr ~= LocalPlayer then
- plr.CharacterAdded:Connect(function(char)
- task.wait(1)
- createDirectionalESP(char)
- end)
- end
- end)
- for _, plr in ipairs(Players:GetPlayers()) do
- if plr ~= LocalPlayer and plr.Character then
- createDirectionalESP(plr.Character)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment