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

Buggy function doesn't return to size if you play with it. Help me please?

Asked by
Irvene 5
9 years ago

This script is buggy, and when I put my mouse off of it, it glitches sometimes and doesnt tween it back to 0, where the x value is originally as the frame. I'd like to know if there's another function of some sort that sets it back to its original position.

JediFrame = script.Parent.Parent.Parent
DescFrame = JediFrame.Desc

script.Parent.MouseEnter:connect(function()
    script.Parent:TweenSizeAndPosition(UDim2.new( 0, 253, 0, 30), UDim2.new( 0, 0, 0, 30), "Out", "Elastic", 0.3)
    DescFrame:TweenSizeAndPosition(UDim2.new( 0, 150, 0, 280), UDim2.new(  0, -150, 0, 20), "Out", "Elastic", 0.5)
end)

Here's the glitch

script.Parent.MouseLeave:connect(function()
    script.Parent:TweenSizeAndPosition(UDim2.new( 0, 0, 0, 30), UDim2.new( 0, 0, 0, 30), "Out", "Elastic", 0.3)
    DescFrame:TweenSizeAndPosition(UDim2.new( 0, 150, 0, 277), UDim2.new(  0, -150, 0, 20), "Out", "Elastic", 0.5)
end)
0
Code block please! EzraNehemiah_TF2 3552 — 9y
0
There, code blocked. Irvene 5 — 9y

1 answer

Log in to vote
1
Answered by
magnalite 198
9 years ago

You are probably leaving it before the tween can finish. Add true to the end of the function calls to allow the functions to override each other. Like this.

JediFrame = script.Parent.Parent.Parent
DescFrame = JediFrame.Desc

script.Parent.MouseEnter:connect(function()
    script.Parent:TweenSizeAndPosition(UDim2.new( 0, 253, 0, 30), UDim2.new( 0, 0, 0, 30), "Out", "Elastic", 0.3, true)
    DescFrame:TweenSizeAndPosition(UDim2.new( 0, 150, 0, 280), UDim2.new(  0, -150, 0, 20), "Out", "Elastic", 0.5, true)
end)

and

script.Parent.MouseLeave:connect(function()
    script.Parent:TweenSizeAndPosition(UDim2.new( 0, 0, 0, 30), UDim2.new( 0, 0, 0, 30), "Out", "Elastic", 0.3, true)
    DescFrame:TweenSizeAndPosition(UDim2.new( 0, 150, 0, 277), UDim2.new(  0, -150, 0, 20), "Out", "Elastic", 0.5, true)
end)

Hope that helps ^-^

0
Well it helps for sure, but the issue is some stuff still will glitch. It's MouseLeave, a very buggy event. Irvene 5 — 9y
Ad

Answer this question