so i need to know if there is transparency in the proporties i tried doing:
if workspace.Model.Transparency then print() end
but it didn't work plz help
There are currently three classes with transparency. They are:
You can use the Instance:IsA
function to detect if the item is one of the classes above. However, this needs to be hardcoded with every class that has transparency.
local TransparencyClasses = {"Decal", "ParticleEmitter", "BasePart"} function CheckForTransparency(TransparentObject) for Index, TransparentClass in pairs(TransparencyClasses) do if Transparent:IsA(TransparentClass) then return true else return false end end end local Part = workspace.Part local PartDecal = workspace.Decal local Attachment = Part.Attachment print(CheckForTransparency(Part)) print(CheckForTransparency(PartDecal)) print(CheckForTransparency(Attachment)) print(CheckForTransparency(workspace))
This will output
true true false false
You need to specify which part inside of a model you would like to check the transparency of, as you cannot directly check the transparency of a model. If you want to check if an object has any transparency at all, here is what you can do:
if workspace.Model.Part.Transparency > 0 then print("Part is transparent.") end
You can check for properties by doing:
local success = pcall(function() if part["Transparency"] then return true end end) if success then -- It has the property end
local Model = workspace.Model for i, v in pairs(Model:GetChildren()) do if v:IsA("Part") and v.Transparency > 0 then print("Test") end end
This should work, it basically loops inside the Model and gets everything inside it, then checks if the children is a "Part" and if it has "Transparency". And if its true it will print "Test" in the output. Correct me if im wrong, i did it without the Studio tho :/