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

Tweening GUIs - open and close button not working?

The scripts are small and kind of self - explanatory. The first one is to open the gui:

local button = script.Parent
local stats = button.Parent.Stats

button.MouseButton1Click:connect(function()
	stats:TweenPosition(UDim2.new({0.025, 0},{0.025, 0}), "Out", "Quart", 2)
end)

The second one is to hide it:

local button = script.Parent
local stats = button.Parent

button.MouseButton1Click:connect(function()
	stats:TweenPosition(UDim2.new({0.025, 0},{1.2, 0}), "Out", "Quart", 2)
end)

--Showing position: {0.025, 0},{0.025, 0}
--Hidden position: {0.025, 0},{1.2, 0}

The buttons and scripts are located differently. The first local script is located in game>StarterGui>MainButtons>StatsButton. The second one is located in game>StarterGui>MainButtons>Stats>Exit. There is no error in the output. When I test the GUI out by opening it, the frame moves up (like I want it to) but it goes to the side slightly. The frame isn't like that when it's set that with the same exact coordinates as default. Then, when I test it farther by clicking the x button, nothing happens. I'm not experienced with scripting guis, so could someone help me?

2 comments

0

Try changing your tween instructions: stats:TweenPosition(UDim2.new(0.025, 0,1.2, 0), "Out", "Quart", 2,true)

0

Basically {} are your enemies, and () are your friends ^

1 answer

✓ Accepted answer

Your issue is that you put tables inside of the UDim2.new, you can fix it by simply getting rid of the "{" and "}"

1 comment

0

Thank you it works perfectly now!

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