Only one tween is playing

local tween = TweenService:Create(blackframe, TweenInfo.new(1), {BackgroundTransparency = 0})
	tween:Play()
	
	tween.Completed:Wait()

	local tween2 = TweenService:Create(blackframe, TweenInfo.new(1), {BackgroundTransparency = 1})
	tween2:Play()

Can anyone explain why only the second tween plays.

1 Like

I’m assuming the blackframe instance’s BackgroundTransparency property is already at 0? If so, then the tween is playing, there’s just no visual.

It’s not its set to 1.
image

Does the code run when the player joins? If so the tween might play before they’re able to actually see it.

Are you trying to make a blackout fade effect

I’m trying to make a blackout fade, and then as soon as that blackout has finished the game fades back in.

This code is under a prompt trigger. When I do trigger the prompt only the second tween seems to play.

Try Scripting it like this:

local TS = game:GetService("TweenService")
local TW = TweenInfo.new(2, Enum.EasingStyle.Linear)

local TGoal = {
	BackgroundTransparency = 0.6
}

local Ngoal = {
	BackgroundTransparency = 0
}

local D = false

local Button = script.Parent
local Frame = script.Parent.Parent.Frame

local TweenT = TS:Create(Frame, TW, TGoal)
local TweenN = TS:Create(Frame, TW, Ngoal)

function Tweener()
	if D == false then
		D = true
		TweenT:Play()
		print("1")
	else
		D = false
		TweenN:Play()
		print("2")
	end
end

Button.MouseButton1Click:Connect(Tweener)



1 Like