0% found this document useful (0 votes)
48 views2 pages

Esp Box 3d

The document is a Lua script for a Roblox game that implements an ESP (Extra Sensory Perception) feature to visually highlight players with red boxes. It creates and manages these boxes based on player positions and visibility, updating them in real-time as players move or respawn. The script also handles player additions and removals to ensure the ESP boxes are appropriately displayed or removed.

Uploaded by

mysigma3727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Esp Box 3d

The document is a Lua script for a Roblox game that implements an ESP (Extra Sensory Perception) feature to visually highlight players with red boxes. It creates and manages these boxes based on player positions and visibility, updating them in real-time as players move or respawn. The script also handles player additions and removals to ensure the ESP boxes are appropriately displayed or removed.

Uploaded by

mysigma3727
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

local Players = game:GetService("Players")

local RunService = game:GetService("RunService")


local Camera = workspace.CurrentCamera

local LocalPlayer = Players.LocalPlayer


local ESPBoxes = {}
local ESPEnabled = true

local function createBox()


local box = Drawing.new("Quad")
box.Thickness = 1
box.Transparency = 1
box.Color = Color3.fromRGB(255, 0, 0)
box.Visible = false
return box
end

local function removeBox(player)


local info = ESPBoxes[player]
if info then
if info.conn then info.conn:Disconnect() end
if info.box then info.box:Remove() end
ESPBoxes[player] = nil
end
end

local function addESP(player)


if player == LocalPlayer or ESPBoxes[player] then return end

local box = createBox()

local conn = RunService.RenderStepped:Connect(function()


if not ESPEnabled then box.Visible = false return end
local char = player.Character
local hrp = char and char:FindFirstChild("HumanoidRootPart")
if not char or not hrp then box.Visible = false return end

local pos, visible = Camera:WorldToViewportPoint(hrp.Position)


if not visible then box.Visible = false return end

local height = 3
local width = 2

local TL = Camera:WorldToViewportPoint(hrp.Position + Vector3.new(-width,


height, 0))
local TR = Camera:WorldToViewportPoint(hrp.Position + Vector3.new(width,
height, 0))
local BR = Camera:WorldToViewportPoint(hrp.Position + Vector3.new(width, -
height, 0))
local BL = Camera:WorldToViewportPoint(hrp.Position + Vector3.new(-width, -
height, 0))

box.PointA = Vector2.new(TL.X, TL.Y)


box.PointB = Vector2.new(TR.X, TR.Y)
box.PointC = Vector2.new(BR.X, BR.Y)
box.PointD = Vector2.new(BL.X, BL.Y)
box.Visible = true
end)
ESPBoxes[player] = {
box = box,
conn = conn
}

player.CharacterAdded:Connect(function()
task.wait(1)
removeBox(player)
addESP(player)
end)
end

for _, plr in ipairs(Players:GetPlayers()) do


addESP(plr)
end

Players.PlayerAdded:Connect(addESP)
Players.PlayerRemoving:Connect(removeBox)

You might also like