Hello I am trying to make an animation on a moving UI, when we click on the playBTN button if the frame is visible we have the animation that shows a frame coming from the right and if the frame is already visible I want the opposite, except that only works when the frame is not visible, why?
playBTN.MouseButton1Click:Connect(function()
--ui.Enabled = false
--rs.Events.UI.MainMenu.Deploy:FireServer()
--currCamera.CameraType = Enum.CameraType.Custom
--workspace.Camera.CameraSubject = plr.Character:FindFirstChildOfClass("Humanoid")
local frame = script.Parent.PlayFrame
if not db_play then
if frame.Visible then
frame.Position = frame.Parent.PlayFrame_End.Position
frame:TweenPosition(
frame.Parent.PlayFrame_Start.Position, -- Start Position
"Out",
"Quad",
.5,
false
)
frame.Visible = false
db_play = true
wait(0.5)
db_play = false
else
frame.Position = frame.Parent.PlayFrame_Start.Position
frame.Visible = true
frame:TweenPosition(
frame.Parent.PlayFrame_End.Position, -- End Position
"Out",
"Quad",
.5,
false
)
db_play = true
wait(0.5)
db_play = false
end
end
end)