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

Why does my gui only tween once and then stops working?

Asked by 7 years ago

I'm trying to make a gui that changes positions using the Tweenposition function but it only works once and won't work again until my player respawns.

Local script located in textbutton:

01local inuse = false
02 
03script.Parent.MouseButton1Click:connect(function()
04    if inuse == false then
05        inuse = true
06        script.Parent.Parent:TweenPosition(UDim2.new(0, 350,0, 230))
07        wait(1.5)
08    end
09 
10end)
11 
12script.Parent.MouseButton1Click:connect(function()
13    if inuse == true then
14        inuse = false
15        script.Parent.Parent:TweenPosition(UDim2.new(0, 10,0, 230))
16        wait(1.5)
17    end
18 
19end)

Thanks!

1 answer

Log in to vote
2
Answered by 7 years ago
Edited 7 years ago
01local inuse = false
02 
03script.Parent.MouseButton1Click:connect(function()
04    if inuse == false then
05            inuse = true
06            script.Parent.Parent:TweenPosition(UDim2.new(0, 350,0, 230))
07    else
08        inuse = false
09            script.Parent.Parent:TweenPosition(UDim2.new(0, 10,0, 230))
10    end
11end)
Ad

Answer this question