All Fade at once

i want all the bodyparts to fade away at once instead of one by one as shown in the video
robloxapp-20200809-2340212.wmv (153.8 KB)
this is the code

local Mob = workspace.Dummy
local Children = Mob:GetChildren()

for i, Child in ipairs(Children) do
    if Child.ClassName == "Part" or Child.ClassName == "MeshPart" then
        for i = 0,1,0.1 do
        Child.Transparency = i
        wait()
        end
        Child:Destroy()
    end
end

The reason why it does each part one at a time is because of how your code is written. It runs as it’s written. So it loops over the parts and then does one part, completes that and then goes to the next part.

Something that may help you is the TweenService

1 Like

can u elaborate?(30 characters)

oh you basically had it to my knowledge

local TweenService = game:GetService("TweenService")
for i, v in ipairs(Children) do
if  v.ClassName == "Part" or v.ClassName == "MeshPart" then
local tweeninfo = TweenInfo.new(0.5) -- how long you want them to take 
local Goal = {}
Goal.Transparency = 1
local tween = TweenService:Create(v, tweenInfo, Goal)
tween:Play()
delay(0.5, function()
v:Destroy()
end)
end
end
2 Likes

Instead of

delay(0.5, function()
v:Destroy()
end)

Wouldn’t it be better to use the Completed event on the tween?

tween.Completed:Connect(function(playbackState)
	v:Destroy()
end)
1 Like

ah, yes, I’m just so used of using delays, bad habit but it should work the same dynamic.

you could use spawn() as an alternative

Could you just make the Mob itself fade away?