How would I make an ESP like ability?

I’m trying to make an ability when u press a certain key u can see NPCs, not players, through objects.

I don’t really know where to start. I’ve seen people say to use viewport frames and billboard GUI, but I’m not exactly sure how viewport frames work.
Is there like a straight forward way to do this? Or is this actually pretty hard to do?

Thank you for your time.

1 Like

I believe this would work for what you’re trying to do.

mhm, surface gui’s, i might be able to do this. Thanks

Alright, thank you for that reference got it to work just like I wanted to. Not sure about the efficiency, but it works.

I know this has already been answered, but I wanted to inform you of another method. Another way you could probably approach this is with the use of ViewportFrames. This way, you get more scalability and customization with whatever you are trying to do. You would make a ViewportFrame the size of a script, make the background transparent, keep updating the camera to the same position as the one of the workspace, and just clone whatever characters you want to clone. Additionally, you could clone custom models to make it look differently, although it is up to you. @iluvtcr’s method also works greatly and is much easier to implement.

1 Like

If u want different result than the Solution.

U can use this project i made a while ago, it uses ViewPortframes
Heatvission.rbxl (96.3 KB)

https://i.gyazo.com/eca264dddb3d3f741c81f9b1d37049c8.mp4
Video example

1 Like

Thank you for this. it is legit perfect. Might take me a few hours just to understand it lol

Hey man, so i’ve been trying to fully implement your solution, while it does seem to work.
Whenever an NPC dies, it doesn’t seem to work anymore.

Do you know why? If it’s too much trouble, it’s ok.

Ups i gota fix that, its just a thing if i forgot to check

1 Like

okay so here is what i forgot to fix

		if RealModule.Humanoid.Health <= 0 then CloneModule:Destroy() table.remove(Humanoids,i) continue end

line 75

Inside the ScreenGui called Controll

1 Like

That fixes the problem with the npc still visible after death. But it doesn’t fix the problem that the npc isn’t highlighted anymore.

ok brb i will do a fast change rq

i redid alot of the code so just copy and paste it

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local VPF = script.Parent.ViewportFrame
VPF.CurrentCamera = workspace.CurrentCamera

wait(1)
local NormalMaterial = Enum.Material.Neon
local DefaultColor = script.DefaultColor
local TypeOfVision = script.IsHeat  

local function MakeCharacter(model)
	model.Archivable = true
	local Clone = model:Clone()
	for _,z in pairs(Clone:GetChildren()) do
		if z:IsA("Script") or z:IsA("LocalScript") then
			z:Destroy()
		else if z:IsA("BasePart") then 
				z.Anchored = true 
				z.Material = NormalMaterial
				z.Color = DefaultColor.Value
					
				if z:IsA("MeshPart") then 
					z.TextureID = "" 
				end 
				if z:FindFirstChildWhichIsA("Decal") then z:FindFirstChildWhichIsA("Decal") :Destroy() end
			else 
				if z:IsA("Accessory") then 
					for _,v in pairs(z:GetChildren()) do
						if v:IsA("BasePart") then
							v.Anchored = true 
							v.Material = NormalMaterial
							v.Color = DefaultColor.Value
							if v:IsA("MeshPart") then 
								v.TextureID = "" 
							else
								if v:FindFirstChildWhichIsA("SpecialMesh") then
									v:FindFirstChildWhichIsA("SpecialMesh").TextureId = ""
								end
							end 
						end
					end
				end 
			end 
		end
	end
	Clone.Humanoid.BreakJointsOnDeath = false
	Clone.Parent = VPF

	return Clone
end

local Humanoids = {}

local function GetHumanoids(part)
	if part ~= char then
		if part:FindFirstChildWhichIsA("Humanoid") then
			table.insert(Humanoids,{part, MakeCharacter(part)})
		else
			for _,z in pairs(part:GetChildren()) do GetHumanoids(z) end
		end
	end
end

workspace.ChildAdded:Connect(function(c)
	wait(1)
	print(c:FindFirstChildWhichIsA("Humanoid"))
	if c:FindFirstChildWhichIsA("Humanoid") and c ~= char then
		table.insert(Humanoids,{c, MakeCharacter(c)})
	end
end)

GetHumanoids(workspace)

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist

game:GetService("RunService").RenderStepped:Connect(function()
	if script.Parent.Enabled == false then return end
	for i,z in pairs(Humanoids) do
		local RealModule = z[1]
		local CloneModule = z[2]
		if not RealModule:FindFirstChildWhichIsA("Humanoid") or RealModule.Humanoid.Health <= 0 then CloneModule:Destroy() table.remove(Humanoids,i) continue end
		
		if TypeOfVision.Value == false then params.FilterDescendantsInstances = {char,Humanoids} if workspace:Raycast(workspace.Camera.CFrame.Position,(RealModule.PrimaryPart.Position - workspace.Camera.CFrame.Position).unit * (workspace.Camera.CFrame.Position - RealModule.PrimaryPart.Position).magnitude,params) then for _,z in pairs(CloneModule:GetChildren()) do if z:IsA("BasePart") and z.Name ~= "HumanoidRootPart" then z.Transparency = 1 end end continue end end
		
		for _,part in pairs(RealModule:GetChildren()) do
			if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
				CloneModule[part.Name].Transparency = 0
				CloneModule[part.Name].Material = NormalMaterial 
				CloneModule[part.Name].Color = DefaultColor.Value
				CloneModule[part.Name].CFrame = part.CFrame
			else if part:IsA("Accessory") then
					for _,v in pairs(part:GetChildren()) do
						CloneModule[part.Name][v.Name].Transparency = 0
						CloneModule[part.Name][v.Name].Material = NormalMaterial --if TypeOfVision.Value == true then CloneModule[part.Name][v.Name].Material = Enum.Material.Plastic else end
						CloneModule[part.Name][v.Name].Color = DefaultColor.Value
						CloneModule[part.Name][v.Name].CFrame = v.CFrame 
					end
				end
			end
		end
	end
end)
1 Like

Still doesn’t seem to work.
I appreciate all the effort. But please don’t go out of your way for me.

is the enemy added to workspace or a folder?

1 Like

all enemies are in a folder…but i tried putting it in the workspace and still doesn’t work.
The enemy is just something i found in toolbox. Can it be the respawn script that it has that causes the problem?

Yea that’s the problem. It can detect them being added to workspace only, but since the respawn script doesn’t really remove the character, it just respawns it.

To work just make sure u do other way of respawning them if u are going to make respawn system

1 Like

alright, ill make my own respawn script. Thank you for all this. Ill let u know when i figure something out.

just made my own respawn script, works like a charm now.
Really, thank you…you’re a life saver.