How to fix this tweening problem

How can i fix this tweening problem? I want it to override the tween and i dont want it to get stuck? Any solutions for that?

Save the last tween outside of the MouseHover connection. Cancel it every single time before you attempt to tween again.

local lastTween = nil

-- connection here
if lastTween then lastTween:Cancel() end
lastTween = newTween
--etc.
1 Like

its still doing the same problem, im using a model tweening function.

Try using tween.Completed:Wait() so that it yield the script to not let other tween to play
Like this:

tween.Completed:Wait()
CFrameValue:Destroy()

Also your part variable is funny

1 Like

Make sure you disconnect your GetPropertyChangedSignal aswell upon tween completion. That could be an issue.

1 Like

lol its supposed to stand for PrimaryPart but i get what u mean

1 Like

Tweens cancel each other out by default.

2 Likes

still same problem here’s my updated script

Can you show the code where you are calling this method?


Yeah here it is

Not in this case, because he is tweening a separate CFrame value each time this is called.

1 Like

Maybe try deleting the frame value in the completed event as well. We just want to make sure there are no traces of the past tween left.


i am already destroying the cframe value

1 Like

Ah I see that now haha.You could try adding a debounce to the MouseEnter connection, and also bind a MouseLeave to toggle that debounce.

1 Like

i already tried that, ill try doing it again and see if it works

Alright, I used that code and it worked, I used a debounce to check when the mouse leaves and enters the button again. Thanks alot for the help.

1 Like

Of course! Glad to help and have a great day!

1 Like