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

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

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

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

4 comments

0

How do I make this work with a gui?

0

Gui Objects have a tweening function built into them. You could use that or you could use TweenService.

0

Yeah but that’s not my question

0

If you want your gui to fade away too, you will need to use BackgroundTransparency, TextTransparency, and ImageTransparency to do it

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