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

How do you make your character fade after pressing a button on a gui?

Asked by 5 years ago

I am making a gui that will play an animation (which I have done already) and then the body will fade away and the screen will fade white(which I have done also). I just need help with making my character fade away when the gui button is pressed.

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
local TweenService = game:GetService("TweenService")

local Time = 1 -- Time (in seconds) it takes to fade
local Remove_Character = false -- If it should remove the character after it finishes

function fadeChar(character)
    for i,v in pairs(character:GetDescendants()) do
        if v:IsA("BasePart") then
            TweenService:Create(v,TweenInfo.new(Time),{Transparency = 1}):Play()
        end
    end
    wait(1)
    if Remove_Character then
        character:Destroy()
    end
end
0
How do I make this work with a gui? MisterPhilo -3 — 5y
0
Gui Objects have a tweening function built into them. You could use that or you could use TweenService. ryan32t 306 — 5y
0
Yeah but that’s not my question MisterPhilo -3 — 5y
0
If you want your gui to fade away too, you will need to use BackgroundTransparency, TextTransparency, and ImageTransparency to do it mybituploads 304 — 5y
Ad

Answer this question