UI Tweens not working correctly

When I keep hovering on my frames, the tweens eventually stop working unless I move my mouse outside really far. Does anyone know how to fix this?
Here is the script that I’ve written. Apologies if this is a repeated topic, I didn’t know what to call this behavior, and just searching “ui tween not working correctly” doesn’t exactly result in what I want.

ClonedFrame.MouseEnter:Connect(function()
			local info = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
			local Shadow = ClonedFrame.Shadow
			local tween = TS:Create(Shadow, info, {Transparency = 0.3})
			
			local textTween = TS:Create(Shadow.Price, info, {TextTransparency = 0})
			Shadow.Price.Text = modelConfigs.Price.."$"
			local textTween2 = TS:Create(Shadow.Prestige, info, {TextTransparency = 0})
			Shadow.Prestige.Text = "Prestige: "..modelConfigs.Prestige
			Shadow.Visible = true
			tween:Play()
			textTween:Play()
			textTween2:Play()
		end)
		
		ClonedFrame.MouseLeave:Connect(function()
			local info = TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
			local Shadow = ClonedFrame.Shadow
			local tween = TS:Create(Shadow, info, {Transparency = 1})
			tween:Play()
			tween.Completed:Connect(function()
				Shadow.Visible = false
			end)
		end)

use Tween:Cancel() and Tween = nil

1 Like

I think I got the gist of it. Let me write this up real quick. Thank you for the answer!

Hi it seems like it’s stacking up the Tweens i recommend making a function for the tween but it’s how ever u want u can do multiple stuff u can either :Cancel upon it doing again or u can check if a tween is running and not tween again or u can do a task.spawnfunction which allows u to overlap the tweens which could look weird tho id recommend making the animation faster tho aswell but how ever u want

1 Like

Making the animation faster did help out a lot. It almost doesn’t happen anymore, while not requiring me to write any new code, and still looks very good. Thanks for the solution!

1 Like

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