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.
COMMUNITY QUESTION
How do you make your character fade after pressing a button on a gui?
1 answer
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
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
How do I make this work with a gui?
Gui Objects have a tweening function built into them. You could use that or you could use TweenService.
Yeah but that’s not my question
If you want your gui to fade away too, you will need to use BackgroundTransparency, TextTransparency, and ImageTransparency to do it