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

Tweening GUIs - open and close button not working?

Asked by 7 years ago

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?

0
Try changing your tween instructions: stats:TweenPosition(UDim2.new(0.025, 0,1.2, 0), "Out", "Quart", 2,true) Dysplexus 50 — 7y
0
Basically {} are your enemies, and () are your friends ^ Kitorari 266 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

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

0
Thank you it works perfectly now! VeryRaven 85 — 7y
Ad

Answer this question