Hello, i was trying to do a OpenButton with the frame doing an animation, i tried to using
local startPos = UDim2.new(frame.Position.X.Scale, frame.Position.X.Offset, 1, frame.Position.Y.Offset)
also
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
0.5, -- Duración de la animación en segundos
Enum.EasingStyle.Quad, -- Estilo de interpolación
Enum.EasingDirection.Out, -- Dirección de interpolación
0, -- Retardo antes de comenzar la animación en segundos
false -- Repetición (false para una sola vez)
)
but didnt work,
this is what i have
and this is what i wanna get
heres the full local script of the open button
local openButton = script.Parent
-- Obtén la referencia al marco que se abrirá
local frame = openButton.Parent:WaitForChild("PatchNotesFrame")
-- Configuración de la animación
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
0.5, -- Duración de la animación en segundos
Enum.EasingStyle.Quad, -- Estilo de interpolación
Enum.EasingDirection.Out, -- Dirección de interpolación
0, -- Retardo antes de comenzar la animación en segundos
false -- Repetición (false para una sola vez)
)
-- Función para abrir el marco con animación
local function OpenFrame()
frame.Visible = true
-- Establece la posición inicial y final del marco para la animación
local endPos = frame.Position
-- Crea la animación usando TweenService
local tween = tweenService:Create(frame, tweenInfo, { Position = endPos })
tween:Play()
end
-- Manejador de eventos para hacer clic en el botón de apertura
openButton.MouseButton1Click:Connect(OpenFrame)
local openButton = script.Parent
-- Obtén la referencia al marco que se abrirá
local frame = openButton.Parent:WaitForChild("PatchNotesFrame")
-- Configuración de la animación
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
0.5, -- Duración de la animación en segundos
Enum.EasingStyle.Quad, -- Estilo de interpolación
Enum.EasingDirection.Out, -- Dirección de interpolación
0, -- Retardo antes de comenzar la animación en segundos
false -- Repetición (false para una sola vez)
)
-- Función para abrir el marco con animación
local function OpenFrame()
-- Establece la posición inicial y final del marco para la animación
local endPos = frame.Position
frame.Position = UDim2.new(endPos.X.Scale, endPos.X.Offset, endPos.Y.Scale, endPos.Y.Offset+20)
-- Crea la animación usando TweenService
frame.Visible = true
local tween = tweenService:Create(frame, tweenInfo, { Position = endPos })
tween:Play()
end
-- Manejador de eventos para hacer clic en el botón de apertura
openButton.MouseButton1Click:Connect(OpenFrame)
Based on what you had first attempted with startPos, this should help you achieve the expected result. After declaring the startPos variable (as a starting position for the frame before the tween occurs), it is also important to make sure the frame is correctly positioned to the startPos.
Give it a shot and feel free to report back on any issues.
Additionally, I’ve taken the tween variable outside of the OpenFrame() function considering the tween does not need to be created each time the function runs. A single instance of the Tween being created outside would be sufficient to then :Play() multiple times from inside the function. This alongside startPos and endPos were also taken outside to assure their values remain constant. You can adjust the Y-axis Scale in startPos accordingly depending on how drastic do you want the animation to be.
local openButton = script.Parent
-- Obtén la referencia al marco que se abrirá
local frame = openButton.Parent:WaitForChild("PatchNotesFrame")
-- Configuración de la animación
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
0.5, -- Duración de la animación en segundos
Enum.EasingStyle.Quad, -- Estilo de interpolación
Enum.EasingDirection.Out, -- Dirección de interpolación
0, -- Retardo antes de comenzar la animación en segundos
false -- Repetición (false para una sola vez)
)
local startPos = UDim2.new(frame.Position.X.Scale, frame.Position.X.Offset, 1, frame.Position.Y.Offset) -- Starting Position (as you've attempted earlier)
local endPos = frame.Position -- Frame positioned exatly where at it's destination after tweening
local tween = tweenService:Create(frame, tweenInfo, { Position = endPos })
-- Función para abrir el marco con animación
local function OpenFrame()
-- Establece la posición inicial y final del marco para la animación
frame.Position = startPos
-- Crea la animación usando TweenService
frame.Visible = true
tween:Play()
end
-- Manejador de eventos para hacer clic en el botón de apertura
openButton.MouseButton1Click:Connect(OpenFrame)
Its working but its breaking the part of the Decoration
-- Configuración
local TEXTSIZE_DEFAULT = 28 -- TextSize predeterminado del TextLabel
local TEXTSIZE_HOVER = 35 -- TextSize cuando el mouse está sobre el TextLabel
local ANIMATION_TIME = 0.15 -- Duración de la animación en segundos
local SOUND_ID = "rbxassetid://13656908459" -- ID del sonido que deseas reproducir
local COLOR_DEFAULT = Color3.new(185/255, 185/255, 185/255) -- Color predeterminado del TextLabel
local COLOR_HOVER = Color3.new(255/255, 255/255, 255/255) -- Color cuando el mouse está sobre el TextLabel
-- Obtener el TextLabel
local textLabel = script.Parent
-- Función para reproducir el sonido
local function playSound(soundId)
local sound = Instance.new("Sound")
sound.SoundId = soundId
sound.Parent = textLabel
sound:Play()
end
-- Función para animar el cambio de color del TextLabel
local function animateColor(color)
local originalColor = textLabel.TextColor3
local timeElapsed = 0
while timeElapsed < ANIMATION_TIME do
local lerpedColor = originalColor:Lerp(color, timeElapsed / ANIMATION_TIME)
textLabel.TextColor3 = lerpedColor
textLabel.BackgroundColor3 = lerpedColor
timeElapsed += wait()
end
textLabel.TextColor3 = color
textLabel.BackgroundColor3 = color
end
-- Función para animar el cambio de TextSize del TextLabel
local function animateTextSize(textSize)
local originalTextSize = textLabel.TextSize
local timeElapsed = 0
while timeElapsed < ANIMATION_TIME do
local lerpedTextSize = originalTextSize + ((textSize - originalTextSize) * (timeElapsed / ANIMATION_TIME))
textLabel.TextSize = lerpedTextSize
timeElapsed += wait()
end
textLabel.TextSize = textSize
end
-- Función para manejar el evento de pasar el mouse sobre el TextLabel
local function onMouseEnter()
animateTextSize(TEXTSIZE_HOVER)
playSound(SOUND_ID)
animateColor(COLOR_HOVER)
end
-- Función para manejar el evento de sacar el mouse del TextLabel
local function onMouseLeave()
animateTextSize(TEXTSIZE_DEFAULT)
animateColor(COLOR_DEFAULT)
end
-- Función para manejar el evento de clic en el TextLabel
local function onClick()
playSound("rbxassetid://13664131241")
end
-- Conectar los eventos del mouse al TextLabel
textLabel.MouseEnter:Connect(onMouseEnter)
textLabel.MouseLeave:Connect(onMouseLeave)
textLabel.MouseButton1Click:Connect(onClick)
Would you mind being a bit more specific or elaborate on what it’s affecting? Are you referring to the buttons on the left not being restored to their original visual state after pressed?
Your original post did not include the code you’ve sent here, so I wouldn’t be able to know of any potential dependencies or have an overall bigger picture of what a certain change might affect.
I didn’t add it because your code messed it up, but what happens is that when you pass the mouse over all the buttons some stay in the Final Size and not in the Initial Size (This also happens when the mouse is not over them)
I understand. Hence, as I previously mentioned, I wouldn’t have been aware of what a certain change might’ve affected in your entire/main code if you haven’t originally provided it.
There can be countless reasons as to why this could be happening. Depending on how you added it and the rest of your code’s contents, this may be the resulting behaviour.
May I ask if the code you’ve posted here is the full code that the affected segments are part of? If so, how was the fixed tweeing code integrated?