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

How can I make my model disapear all at once with parts put inside? Also please fix the script. [closed]

Asked by 10 years ago

e = game.Workspace.Exterior:GetChildren()

for i, v in pairs (e) do if v.ClassName == "Part" and v.ClassName == "WedgePart" then for i = 0, 1, 0.1 do v.Transparency = i wait(0.1) end end end

Locked by adark, Spongocardo, and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
2
Answered by 10 years ago

first, I would set up a function to get all the objects in a table.

local stuff = {} -- empty table

function get(model) -- function
for i,v in pairs(model:GetChildren()) do -- loop through all objects
if pcall(function() v.Transparency = 0 end) then table.insert(stuff,v) end -- if "Transparency" is a property
get(v) -- repeat loop on the object (for models within models and decals also)
end
end

get(workspace.Exterior) -- get all the Transparency items within "Exterior"

for i = 0,1,.1 do -- loop from 0 to 1 (from visible to invisible)
wait(.1)
for t,k in pairs(stuff) do -- loop through all your parts
k.Transparency = i -- set each part (or decal) to its transparency
end
end

I hope this makes sense. The

pcall(function() v.Transparency = 0 end) then end

basically determines if v, an object or decal or whatever, if it has "Transparency" as a property. if it does have the property, it returns true and does "table.insert(stuff,v)". then it loops upon itself until all objects are inside the table.

0
OMG THANK YOU, YOUR THE ONLY PERSON WHO MADE IT WORK!!! OMG THANK YOU SO MUCH, I CAN MAKE MY GAME NOW CALLED : Doctor Who: TARDIS iDoctorW 0 — 10y
0
How can I make it onClicked()? iDoctorW 0 — 10y
0
Post that in a different question. Octillerysnacker 115 — 10y
Ad