How to make parts view able through walls

Kind of like the “AlwaysOnTop” property of billboardgui’s. I’ve seen this done before, how would this be completed?

I haven’t really worked much with this, but I’ve seen Parts being put into the Camera view, but again I don’t know just something to think about.

1 Like

I’m not very educated on parts in the camera, I know it’s used for like, FPS games to make first person guns, other than that I’ve no clue.

I also do not know if this is possible but:
What if you put a billboard gui in the part and then put a viewport frame of the part in the billboardgui and just set the AlwaysOnTop bool to true in the billboard gui.

How would that work if the viewport frame requires a camera? Plus I feel this is highly ineffective, I dunno though.

There really is no perfect solution, but I just did this myself to see if ViewportFrames were viable.

What I did was I created a ScreenGui with a ViewportFrame. The ScreenGui was set to ignore the Gui Offset, otherwise there would be a visual offset too. The ViewportFrame also was scaled to fit the entire screen, and was made to have a background transparency of 1.

After that, its really as simple as cloning over what you want to be rendered above everything else once, and then updating them when they move. You also just need to set the ViewportFrame to the Workspace’s CurrentCamera property.

The result worked fairly well actually, and I believe it could work for many usecases, hopefully yours included. Hope I helped.

Perhaps the InvisiCam option in StarterPlayer might answer to your needs appropriately?

Otherwise, maybe this could help?

I feel like he’s trying to go for an ESP type of deal, like POLYGUNS has when you get killed by someone.

I think you have to use ViewportFrame and Camera:WorldToScreenPoint

My guess is cloning the part which you want to see through walls parent it to the viewportframe and with WorldToScreenPoint position viewportframe.

46 Minutes later

So I’ve made this

local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

local CurrentCamera = Workspace.CurrentCamera

local ScreenGui = Instance.new("ScreenGui")
local ViewportFrame = Instance.new("ViewportFrame")

ScreenGui.Parent = PlayerGui
ViewportFrame.Parent = ScreenGui

ViewportFrame.BackgroundTransparency = 1
ViewportFrame.Size = UDim2.new(0, 100,0, 100)

local Camera = Instance.new("Camera")
Camera.Parent = ViewportFrame

function Show(Part)
	
	local Clone = Part:Clone()
	
	Clone.Parent = ViewportFrame
	
	Clone.Position = Vector3.new(0, 0, 0)
	Clone.Orientation = Vector3.new(0, 0, 0)
	
	Camera.CFrame = Clone.CFrame * CFrame.Angles(0,0,0)
	
	Clone.Position = Vector3.new(
		0,
		0,
		-((Clone.Size.X * 2) + (Clone.Size.Z * 2)) + Clone.Size.Y * 2)
	
	RunService.Stepped:Connect(function()
		
		local Position = CurrentCamera:WorldToScreenPoint(Part.Position)
		
		ViewportFrame.Position = UDim2.new(0, Position.X - 50, 0, Position.Y - 50)
	end)
end

Show(Workspace.Show)


image

5 Likes

I found a forum post discussing this using a module and it fits my exact needs.

2 Likes