Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 answer

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.

3 comments

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

0

How can I make it onClicked()?

0

Post that in a different question.

This discussion is preserved as it was. New answers, comments, and votes are closed.