I am a new developer trying to make an obby. recently i had the the idea to make a tool that turns all transparency parts red and and visible, and back when the tool is not being held. please help. it has mainly been ripped from the roblox dev site and im trying to not show parts with scripts in them
local tool = script.Parent local function onEquip() tool.Equipped:Connect(onEquip) local function makeXRayPart(part) part.LocalTransparencyModifier = 0 end local function recurseForParts(object) if object:IsA("BasePart") then makeXRayPart(object) end if object.Transparency == 1 then if object:IsA("Script") or object:IsA("LocalScript") then return end end for _, child in pairs(object:GetChildren()) do recurseForParts(child) end if object:FindFirstChildOfClass("LocalScript") or object:FindFirstChildOfClass("Script") then return end end recurseForParts(workspace) end