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

How to slowly fade out a model?

I'm trying to use a loop to slowly increase a model's transparency. How would I go about doing that?

1 answer

✓ Accepted answer
local FadeModel_Out = function(ModelEntity, Speed)
   -- Put your supported Instance's that have Transparency property
    local SupportedTypes = {
     'Part';
    } 

    if ModelEntity:IsA("Model") then
        local Entities = ModelEntity:GetDescendants()
        for _,OBJ in next, Entities do
            for _,Type in next, SupportedTypes do
                if OBJ:IsA(Type) then
                spawn(function()
                  repeat
                    OBJ.Transparency = OBJ.Transparency + 0.1
                    wait(Speed)
                  until OBJ.Transparency == 1
                  end)
                end
            end
        end
    end
end

FadeModel_Out(workspace.Model, .01)
-- Arguement[1] Is your model directory path.
-- Arguement[2] Is your speed you want it to fade at.

I hope this helps your needs!

3 comments

0

Wow. This is actually pretty clever. I thought I had to use a 'for' loop on all the parts of a model, but of course it could be a lot of parts. I might use this one day! Thanks!

0

While I'm glad you help people, please don't spoonfeed code like you did here since people don't learn from this.

0

Thank you for the help but I don't really understand how this works. Do I have to set a variable for "Speed"?

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