Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make parts draw(render) over other parts?

I've seen games that employ these, they act like part xrays. They allow you to see outlines of a part while being covered by another part. I tried looking up the properties of BasePart but the only thing close to it is LocalTransparencyMultiplier but it seem to not work.

Taking from the wiki: "This code sample gives the local client X-ray vision using LocalTransparencyModifier. It allows the player to see through all parts in the Workspace, which are found using recursion." it just makes all the parts translucent without the promised xray vision.

1 comment

0

not possible

1 answer

It is not possible to make a specific part render on top of everything, but you can use a ViewportFrame, though lighting won't affect the part

local Part = workspace.AlwaysOnTopPart --The part to be rendered on top
local Gui = Instance.new('ScreenGui') --Create gui container
local ViewportFrame = Instance.new('ViewportFrame')
Gui.Parent = game.Players.LocalPlayer.PlayerGui
ViewportFrame.Parent = Gui
ViewportFrame.Size = UDim2.new(1,0,1,36) --Set ViewportFrame size, the 36 is there so that you can still see the parts when under TopBar
ViewportFrame.Position = UDim2.new(0,0,0,-36)
ViewportFrame.BackgroundTransparency = 1
ViewportFrame.CurrentCamera = workspace.CurrentCamera
game:GetService('RunService').RenderStepped:Connect(function() --Run following every frame
	local PartClone = Part:Clone() --Clones the part
	PartClone.Anchored = true
	PartClone.CanCollide = false
	PartClone.Parent = ViewportFrame.Parent
	game.Debris:AddItem(PartClone,0.0001) --Remove Clone after one frame
end)

Video

This discussion is preserved as it was. New answers, comments, and votes are closed.