Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Tween service tweeining overriding and MouseLeave problems. Help?

Asked by 5 years ago

So, my problem is that I'm trying to override an already tweening GUI.

I was trying to make the leave function override hover's(in the script further down) tweening so that if you move your mouse away before the tweening is finished, it'll jump right onto the leave function.

By the time, I met an another problem...

It looks like if I move my mouse onto an another GUI and the onto my screen without any guis, the tweening won't run. I'm kinda new into tweening, and I have no idea how to fix this. I was searching for half an hour on the web for a solution, with no results.

This is the output while MouseEnter and MouseLeave gets fired:

https://gyazo.com/77ea89c4a76ec68e24b266b6e74d586f

This is my script:

Arrow = script.Parent
Shop = Arrow.Parent

local function hover()
    print("Startin'")
    local Arrow = script.Parent
    local shop = Arrow.Parent
    shop:TweenPosition(UDim2.new(0, 0, 0.25, 0), "Out", "Quad")
end


local function leave()
    print("Leavin'")
    local Arrow = script.Parent
    local shop = Arrow.Parent
    local tmp = shop:TweenPosition(UDim2.new(-0.12, 0, 0.25, 0), "Out", "Quad", true)
    print("Result tween: ", tmp) 
end




Arrow.MouseEnter:connect(hover)
Arrow.MouseLeave:connect(leave)
Shop.MouseLeave:connect(leave)

This is where my GUI is placed in workspace with all childrens:

https://gyazo.com/46f3a7137972bd9d523f25f66c6f7e56

It would be great if you could give me an answer to both of my problems. I would be very happy if you could give me wikis to look at and study. I do not ask for any code, since I want to learn this not by just getting a code, but by reading, and testing. ^^

I appreciate any kind of help. c;

Sincerely, ~WaterFoox

0
I don't think TweenPosition returns anything. User#19524 175 — 5y
0
It does return a bool. The bool is true or false depending if the tween was overriden. fighter169mobile 123 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

If you want your tween to be overridden by another tween, you need to change the 5th argument to true. This is the boolean that determines whether the tween can be overrided or not.

Example:

shop:TweenPosition(UDim2.new(0, 0, 0.25, 0), "Out", "Quad", 1, true)

You did earlier:

shop:TweenPosition(UDim2.new(-0.12, 0, 0.25, 0), "Out", "Quad", true)

But that is the 4th argument.

Hope this helps!

1
Wow! Thank you very much! It actually fixed both of my problems. I don't know why, but thank you. ^^ TheWaterFoox 255 — 5y
Ad

Answer this question