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
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
This works btw. Some people are trolling by downvoting it. Try it out! I promise you it works.
so those downvotes are trolls?
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 :/
what if the transparency is 0 or 0.3 or 0.5 or 0.8 or 0.63?
also if the part doesn't have the Proportie Transparency then that script will run an error
Invalid global "Part". Please watch the script anaylsis
It was an example obviously, he would need the variables
Fixed it!
I tested it and it works! So there you go! UPVOTE ME! xd
Is this serious?
if (part name here).Transparency == (Transparency Level) then
print("Success!")
end
You don't have a print statement, Thus not printing the line in the output.
this dosent work tbh
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
this is obviously a troll
????????????????????? what????? im so confuzed??????????????
You didn't put anything in the print box, and try using this: if workpsace.Model.Transparency > 0 then print("Part is either semi-transparent or invisible!)
Oh, I am sorry I did not see that DemGame had already posted this answer. I wish you luck on your scripting journey!