Why doesn't this code tween this frame?

  1. What do you want to achieve? Keep it simple and clear!
    I want the code to tween the gui from background transparency 1 to 0 and then 0 to 1
  2. What is the issue? Include screenshots / videos if possible!
    The issue is that nothing happens when I run the code as the gui does not change transparency

I have not found any solutions for this so far and the script is a local script and the frame is startergui

local TweenService = game:GetService("TweenService")


local Transparency_tween = TweenService:Create(
	script.Parent,
	TweenInfo.new(5,Enum.EasingStyle.Linear),
	{Transparency = script.Parent.BackgroundTransparency}
)
Transparency_tween:Play()

Transparency_tween.Completed:Connect(function()
	print("Tween Not working")
end)

I personally am unsure on how to solve this however you can contact my friend who may at Space
#2373 on discord or @usedSpxse on this forum.


Signed.
Kieranl29 Founder of D&R Studio and Dev forum helpers

This is because the tween won’t change the transparency due to it already being what you are trying to tween it to. I recommend using 2 tweens instead.

local TweenService = game:GetService("TweenService")


local Transparency_tween = TweenService:Create(
	script.Parent,
	TweenInfo.new(5,Enum.EasingStyle.Linear),
	{Transparency = 1}
)
Transparency_tween:Play()

local Transparency_tween2 = TweenService:Create(
	script.Parent,
	TweenInfo.new(5,Enum.EasingStyle.Linear),
	{Transparency = 0}
)

Transparency_tween.Completed:Connect(function()
	Transparency_tween2:Play()
end)
1 Like

Thank you it works but do you have any tips for avoiding scenarios like this I have never really used Tween service before

I’m not all that good at it myself, but tweenservice only changes it when its not equal to what it already is. Tbh, for this scenario thats only thing that really comes to mind for tips.

1 Like