Fading Title Screen

Hi hello yes,
Im making a intro gui like Loomian legacy from Phantix’s tutorial and its not fading. and fixes:

  • Code: Fading Function
    image

  • Code: Calling Function
    image

The Background is disappearing but its not fading

Full script:

local Camera = workspace.CurrentCamera

local Player = game.Players.LocalPlayer

repeat wait() until Player.Character

Camera.CameraType = Enum.CameraType.Scriptable

Camera.CameraSubject = nil

local train = script.Parent.Logo

function FadeFunc(start, finish, step)

for i = start, finish, step do

script.Parent.Parent.Frame.BackgroundTransparency = 1

wait()

end

end

wait(1)

train:TweenPosition(UDim2.new(1.301,0,0.5,0),“Out”,“Sine”,9)

wait(2)

text = “ScxiptedShark Presents”

for i = 1, #text do

script.Parent.TextLabel.Text = string.sub(text,1,i)

wait(0.05)

end

wait(4)

script.Parent.TextLabel.TextTransparency = 0.5

wait(0.1)

script.Parent.TextLabel.TextTransparency = 0.8

wait(0.1)

script.Parent.TextLabel.TextTransparency = 1

wait(4)

script.Parent.Parent.Parent.IntroMusic:Play()

script.Parent.GameLogo:TweenPosition(UDim2.new(0.5,0,0.3,0))

wait(1)

script.Parent.Logo2:TweenPosition(UDim2.new(0.5,0,0.7,0))

wait(2)

script.Parent.GameLogo:TweenPosition(UDim2.new(0.5,0,0.2,0))

script.Parent.Logo2:TweenPosition(UDim2.new(0.5,0,0.8,0))

wait(2)

FadeFunc(0, 1.1, 0.5)

It’s because you’re setting the transparency to 1 no matter what and not the i variable. Also, TweenService would be a better idea because you can easily customize how fast it fades.

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(fadeTime, Enum.EasingStyle.Linear)
local tween = TweenService:Create(gui, tweenInfo, {BackgroundTransparency = 1})
tween:Play()
1 Like

Where should i put it? should i replace it?

Put this is the fade function, along with 1 parameter which is the fadeTime. You’ll also have the change the gui variable to your frame.

local TweenService = game:GetService("TweenService")

local function Fade(guiObject, fadeTime)
	local tweenInfo = TweenInfo.new(fadeTime, Enum.EasingStyle.Linear)
	local tween = TweenService:Create(guiObject, tweenInfo, {BackgroundTransparency = 1})
	tween:Play()
end

Fade(script.Parent.Parent.Frame, 1)
1 Like

my brain in Confused, i’m not that experinced.

TweenService basically changes values very precisely which makes it look very smooth. You can learn more about it with the wiki or youtube.

https://developer.roblox.com/en-us/api-reference/class/TweenService
https://developer.roblox.com/en-us/api-reference/datatype/TweenInfo

1 Like

I understand what It is, just the placing

It worked! thanks! :slight_smile: :heart:

1 Like

Oh ok. Put the TweenService variable on the top of the script. You’ll want to replace your old Fade function with this:

local function Fade(guiObject, fadeTime)
	local tweenInfo = TweenInfo.new(fadeTime, Enum.EasingStyle.Linear)
	local tween = TweenService:Create(guiObject, tweenInfo, {BackgroundTransparency = 1})
	tween:Play()
end

Then scroll all the way down and change the calling function to:

Fade(script.Parent.Parent.Frame, 1)
1 Like