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

why doesn't my code to change transparent blocks?

Asked by 3 years ago
Edited 3 years ago

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
0
i diddn't write the changing back into transparrent as it is essentially the same Owlsee_owldo 0 — 3y
0
You need to write a loop to get all the parts in the workspace. Basically what you are telling it is to change the transparency of workspace itself and not the parts inside of it. Warfaresh0t 414 — 3y

Answer this question