What I want to achieve:
I want to make the GUI tween from (0, 0, 0, 0) to its original size (OgSize var)
There’s also other GUI in that GUI that I want to tween back to it’s original size too.
Issue:
Basically I want to loop through all the buttons in a frame to tween to save time.
So I get the original size and save it in a variable then set the size to (0, 0, 0, 0)
But instead, when I try to set the size of GUI to (0, 0, 0, 0) and then tween it to it’s original size, (the OgSize var) it doesn’t start at (0, 0, 0, 0) and it tweens to (0, 0, 0, 0).
I don’t know why its happening
Btw every time after the first I execute this, it just shrinks more (disappears)
This is the script:
local button = script.Parent
local exitbutton = script.Parent.Parent.Parent.SkillTreeExitButton
local buttonsframe = script.Parent.Parent
local skilltreeframe = script.Parent.Parent.Parent.SkillTreeFrame
local mainskilltree = skilltreeframe.DragFrame.MainFrame
local hoversound = script.Hover
button.InputBegan:Connect(function()
hoversound:Play()
end)
button.Activated:Connect(function()
buttonsframe.Visible = false
skilltreeframe.Visible = true
exitbutton.Visible = true
for _, v in mainskilltree:GetDescendants() do
if v:IsA("ImageButton") then
local OgSize = v.Size
v.Size = UDim2.new(0, 0, 0, 0)
v:TweenSize(UDim2.new(OgSize), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 0.5, false)
elseif v:IsA("TextLabel") then
local OgSize = v.Size
v.Size = UDim2.new(0, 0, 0, 0)
v:TweenSize(UDim2.new(OgSize), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 0.5, false)
end
task.wait()
end
end)