TweenService stuck

I am working on a GUI that enlarges when you move the mouse over it until you leave it again with the mouse. But if I leave the field with the mouse before the animation is finished, the GUI is stuck at this size. Can anyone help me?

script.Parent.MouseEnter:Connect(function()
	script.Parent.Bar:TweenSize(UDim2.new(1, 0, 0, 5), "Out", "Sine", 0.5)
end)

script.Parent.MouseLeave:Connect(function()
	script.Parent.Bar:TweenSize(UDim2.new(0.1, 0, 0, 5), "In", "Sine", 0.5)
end)

May you show code related to your issue…?

Sorry I forgot to insert the script

You’re not using TweenService, you’re using tween methods of GuiObjects. To me these are unreliable and you should focus on using the actual TweenService. This is one, more reliable, and two, it would be helpful to practice using this now.

Is there any way to provide a sample script to fix the problem? You could also send me the DevHub link. I am very new to using TweenService.

image

How you should learn to use it:

local object -- Fill in the variable
local info = TweenInfo.new(
    1, -- Time
    Enum.EasingStyle.Quad, -- Style
    Enum.EasingDirection.Out, -- Style Direction
    4, -- Repeat count
    true, -- Reverse before repeat
    0.25, -- Delay before repeat
)
local props = {
    Color = Color3.new(1,0,0) -- Turning Red
}

game.TweenService:Create(part, info, props):Play()

How I use it (memory efficient):

game.TweenService:Create(Object, TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),
    {Position = UDim2.new(0.5,0,0.5,0)}):Play()

How others use it (preformance efficient):

local tween = game.TweenService:Create(Object, TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),
    {Position = UDim2.new(0.5,0,0.5,0)})
-- later:
tween:Play()

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