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

I keep getting Transparency is not a valid member of model?

Asked by 4 years ago

So I am trying to make an object no longer transparent but I keep getting the error message Transparency is not a valid member of Model. My code is here:

Model.Transparency = 0

There are no other things named Model, and I have tried changing the name but to no success. What am I doing wrong?

2 answers

Log in to vote
1
Answered by 4 years ago

only parts can become transparent -> there still is a way tho

if u add a script in the model and paste this in the script and it will loop through and determine if v is a part and then make it transparent else just prints in the output 'not needed' if it isn't a part.

for i,v in pairs(script.parent) do
    if v:IsA("Part") then
        v.Transparency = 0
    else
        print'not needed'
    end
end
0
Use v:IsA("BasePart") will also turn unions and meshes to transparent. Headstackk 45 — 4y
0
that wont work, **pairs()** needs a table, not just a model Kriscross102 118 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

you need to loop through the model and make each part transparency 0

for _,part in pairs(Model:GetDescendants()) do
    if part:IsA("BasePart") then
        part.Transparency = 0
    end
end

Answer this question