Hello, I am trying to create a map spawner for my game. I'd like to script something that gets a single descendent of a model, then slowly change it's transparency to visible (sounds neat, right?). It'll repeat that process for every part in the model until the entire thing is visible, then stop when completed. Does anyone have an idea on how I can get this done with a script? How would I make a GetDescendent loop that grabs one part at a time?
COMMUNITY QUESTION
GetDescendants, but one at a time?
1 answer
:GetDescendants() is gives a table. I would recomend a for loop with in pairs (or ipairs if you want). Each loop will give one single object before moving to the next one. Just don't forget a wait.
local char = game:GetService("Players").chloe_price65.Character
for i,v in pairs(char:GetDescendants())do
if v:IsA("MeshPart") then -- Checking for meshparts
print("This is a meshpart.") -- code to execute
wait(10) --[[amount of time it takes to supposed to execute code. If left empty, all of the code will execute really fast]]
end
end
2 comments
1
Use ipairs, not pairs. GetDescendants() returns an array.
0
i could use that too
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Look into Tweens. You can use them to animate the transparency change for every part over a specifiable amount of time. You can even set delays for when they start! Let me know if you want more help and I'll be glad to do a larger writeup. https://developer.roblox.com/api-reference/datatype/TweenInfo https://developer.roblox.com/api-reference/class/TweenService