Tween Service Problem

The second time round I click the “MENU” button it doesn’t have the nice fade effect. I want the fade effect to always work every time I click the “MENU” button.

I think the issue may be to do with the values but I can’t quite understand my thoughts.

[Uploading: 2022-04-23 15-03-00.mp4…](Video of Problem)

local back_button = gui.Store.back_button
back_button.MouseButton1Down:Connect(function()
	back_button.MouseEnter:Connect(function()
		back_button:TweenSize(UDim2.new(0.205, 0, 0.097, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2, true)
	end)

	back_button.MouseLeave:Connect(function()
		back_button:TweenSize(UDim2.new(0.181, 0, 0.085, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2, true)
	end)
	
	back_button.MouseButton1Down:Connect(function()
		
		local tween1 = game.TweenService:Create(gui.Fade, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),{["BackgroundTransparency"] = 0})

		tween1:Play()
		tween1.Completed:wait()

		gui.Buttons.Visible = true
		gui.Store.Visible = false

		tween1 = game.TweenService:Create(gui.Fade, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {["BackgroundTransparency"] = 1})

		tween1:Play()
		tween1.Completed:wait()
	end)
	
end)

The video didn’t seem to load so here’s a retry. Hope it works!

1 Like

I would say just copy the script from the shop tween script and paste it in the menu button, and custom it so that it gets back to the menu…

1 Like

Thanks for your reply!
Just tried it. Still has the same problem.

It actually did work after I changed one of the variables and ran it in the i,v loop!
Thank you so much!

1 Like