I want to fade out the frame when a Player presses the button “Ok” and then it would play a nice animation using TweenService to fadeout the UI & destroy it.
I tried figuring it out by looking it up everywhere but there was nothing to be found, I managed to use the TweenService animation for my button which works fine and I’ll be linking the code below. I’ll also place a screenshot below that can show how the Frames are placed for a clearer explantion.
Started coding around 1-2 weeks ago just trying to do things on my own now after I spent some time learning the fundamentals of Lua but sometimes I just need some feedback because it does get confusing
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local IsHovering = false
local Button = script.Parent
Button.MouseEnter:Connect(function()
IsHovering = true
Button:TweenSize(UDim2.new(0.25, 0, 0.3, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.2, true)
end)
Button.MouseLeave:Connect(function()
IsHovering = true
Button:TweenSize(UDim2.new(0.2, 0, 0.25, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.2, true)
end)
local Sound = game.SoundService.HoverSound
Button.MouseButton1Click:Connect(function()
Sound:Play()
end)