Tweening GUI Transparency

So I’m making a transition screen which after the screen is wiped to black, a Frame colour block fades into view with Tween affecting transparency in mind. However, there’s an issue with that final part.

Tween2.Completed:Connect(function(summonscreen)
	
		local screentweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)

		local screenfade1 = TweenService:Create(loadscreen.BackgroundTransparency, screentweenInfo, 1)
		local screenfade2 = TweenService:Create(loadtext.TextTransparency, screentweenInfo, 1)
		
	end)

end

The error pops up at screenfade1, which says in the Output that it “can’t cast to Object”.

2 Likes

You want to have ‘loadscreen’ as the first argument, not loadscreen.BackgroundTransparency. Set it up like this:

TweenService:Create(loadscreen, screentweenInfo, {BackgroundTransparency = 1} )

7 Likes

[EDIT] That works :3 ^^^

The first parameter of TweenService:Create() is an object value, the third parameter is a dictionary containing the name of the property to be changed and the value to be changed to

1 Like

Thanks! Also I mixed up the Transparency numbers between 0 and 1, which sent me for a spin for a while.
Here it is!

17 Likes