Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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:

local inuse = false

script.Parent.MouseButton1Click:connect(function()
	if inuse == false then
		inuse = true
		script.Parent.Parent:TweenPosition(UDim2.new(0, 350,0, 230))
		wait(1.5)
	end

end)

script.Parent.MouseButton1Click:connect(function()
	if inuse == true then
		inuse = false
		script.Parent.Parent:TweenPosition(UDim2.new(0, 10,0, 230))
		wait(1.5)
	end

end)

Thanks!

1 answer

✓ Accepted answer
local inuse = false

script.Parent.MouseButton1Click:connect(function()
	if inuse == false then
        	inuse = true
        	script.Parent.Parent:TweenPosition(UDim2.new(0, 350,0, 230))
	else
		inuse = false
        	script.Parent.Parent:TweenPosition(UDim2.new(0, 10,0, 230))
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.