Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local runService = game:GetService("RunService")
- local corpsesFolder = workspace:WaitForChild("Corpses")
- local espEnabled = false
- local espObjects = {}
- local updateConn
- -- GUI
- local gui = Instance.new("ScreenGui")
- gui.Name = "CorpseESP_GUI"
- gui.ResetOnSpawn = false
- gui.Parent = player:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame", gui)
- frame.Size = UDim2.new(0, 200, 0, 110)
- frame.Position = UDim2.new(0.5, -100, 0.5, -55)
- frame.BackgroundColor3 = Color3.fromRGB(30,30,36)
- frame.BorderSizePixel = 0
- frame.Active = true
- frame.Draggable = true
- Instance.new("UICorner", frame).CornerRadius = UDim.new(0,10)
- local title = Instance.new("TextLabel", frame)
- title.Size = UDim2.new(1, -32, 0, 28)
- title.Position = UDim2.new(0, 10, 0, 6)
- title.BackgroundTransparency = 1
- title.Text = "Corpse ESP"
- title.Font = Enum.Font.GothamBold
- title.TextSize = 14
- title.TextColor3 = Color3.fromRGB(240,240,240)
- title.TextXAlignment = Enum.TextXAlignment.Left
- local closeBtn = Instance.new("TextButton", frame)
- closeBtn.Size = UDim2.new(0, 24, 0, 24)
- closeBtn.Position = UDim2.new(1, -30, 0, 6)
- closeBtn.Text = "✕"
- closeBtn.Font = Enum.Font.GothamBold
- closeBtn.TextSize = 14
- closeBtn.TextColor3 = Color3.fromRGB(255,140,140)
- closeBtn.BackgroundTransparency = 1
- local toggleBtn = Instance.new("TextButton", frame)
- toggleBtn.Size = UDim2.new(0.8, 0, 0, 36)
- toggleBtn.Position = UDim2.new(0.1, 0, 0.55, 0)
- toggleBtn.BackgroundColor3 = Color3.fromRGB(46,46,56)
- toggleBtn.Text = "Enable ESP"
- toggleBtn.Font = Enum.Font.Gotham
- toggleBtn.TextSize = 14
- toggleBtn.TextColor3 = Color3.fromRGB(255,255,255)
- Instance.new("UICorner", toggleBtn).CornerRadius = UDim.new(0,6)
- -- ESP
- local function getRoot(model)
- return model:FindFirstChild("HumanoidRootPart")
- or model.PrimaryPart
- or model:FindFirstChildWhichIsA("BasePart")
- end
- local function createESP(model)
- if espObjects[model] then return end
- local root = getRoot(model)
- if not root then return end
- local highlight = Instance.new("Highlight")
- highlight.Parent = model
- highlight.FillTransparency = 1
- highlight.OutlineTransparency = 0
- highlight.OutlineColor = Color3.fromRGB(200,200,255)
- local bill = Instance.new("BillboardGui")
- bill.Parent = model
- bill.Adornee = root
- bill.Size = UDim2.new(0, 120, 0, 22)
- bill.StudsOffset = Vector3.new(0, 2, 0)
- bill.AlwaysOnTop = true
- local text = Instance.new("TextLabel", bill)
- text.Size = UDim2.new(1,0,1,0)
- text.BackgroundTransparency = 1
- text.Font = Enum.Font.GothamBold
- text.TextSize = 12
- text.TextStrokeTransparency = 0.3
- text.TextColor3 = Color3.fromRGB(220,220,255)
- text.Text = model.Name
- espObjects[model] = {highlight, bill}
- end
- local function clearESP()
- for _, objs in pairs(espObjects) do
- for _, o in ipairs(objs) do
- if o then o:Destroy() end
- end
- end
- espObjects = {}
- end
- local function updateESP()
- for _, corpse in ipairs(corpsesFolder:GetChildren()) do
- if corpse:IsA("Model") then
- createESP(corpse)
- end
- end
- end
- toggleBtn.MouseButton1Click:Connect(function()
- espEnabled = not espEnabled
- toggleBtn.Text = espEnabled and "Disable ESP" or "Enable ESP"
- if espEnabled then
- updateConn = runService.RenderStepped:Connect(updateESP)
- else
- if updateConn then updateConn:Disconnect() end
- clearESP()
- end
- end)
- closeBtn.MouseButton1Click:Connect(function()
- if updateConn then updateConn:Disconnect() end
- clearESP()
- gui:Destroy()
- end)
Advertisement
Add Comment
Please, Sign In to add comment