Tween not playing

Im working on trying out how to tween a gui into appearing however I have little to none experience in it so can anyone tell me why this isnt working?
Nothing prints

local TweenService = game:GetService("TweenService")
local Fade = game.StarterGui.Fade
game.StarterGui.ScreenGui.TextButton.MouseButton1Click:Connect(function(Clicked)
	print("Clicked")
	local goal = {}
	Fade.Visible = true
	Fade.BackgroundTransparency = 0

	local tweenInfo = TweenInfo.new(5)
	local tween = TweenService:Create(Fade, tweenInfo, goal)
	
	tween:Play()
end)

No errors are showing up

Yeah, it does not work because you have not put anything inside of the goal table.
I assume you want to change the BackgroundTransparency to 1, then do:

local goal = {BackgroundTransparency = 1}

You’re never assigning a target, like the person above me said.

Try something like:

print("Clicked")
	local goal = {BackgroundTramsparency = 1}
	Fade.Visible = true
	Fade.BackgroundTransparency = 0

	local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
	local tween = TweenService:Create(Fade, tweenInfo, goal)
	
	tween:Play()

also, referring to StarterGui means that this function will never be run anyway. If this is on the client, use a LocalScript within the element. You must refer to PlayerGui on the server, but it’s not recommended to handle GUI on the server anyway.

Will this work?

local goal = {Visible = true, BackgroundTransparency = 0}

You can’t tween visibility. You’d need to set that beforehand.

Hmm, Try using this…

local TweenService = game:GetService("TweenService")
local Fade = game.StarterGui.ScreenGui.Fade
local TextButton = game.StarterGui.ScreenGui.TextButton 

TextButton.MouseButton1Click:Connect(function()
    print("Clicked")
    
    Fade.Visible = true -- Visible or Invisible
    Fade.BackgroundTransparency = 1 -- Start fully transparent

    local goal = {BackgroundTransparency = 0} -- Tween to fully opaque

    local tweenInfo = TweenInfo.new(5)
    local tween = TweenService:Create(Fade, tweenInfo, goal)
    
    tween:Play()
end)

that still wouldn’t work because of this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.