Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago

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.

0
not possible LoganboyInCO 150 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

Ad

Answer this question