Tween Gui on touch and Close Button

Hey! Some time ago I made a similar post but now I would like to know if it is possible to activate a Gui by touching a part and then closing it with a button and leaving with the same tween effect?

Yes it is, just use the Touch event and have a variable if its open already, if it is just tween it out, if its not tween it in.
Example Script:

local TweenService = game:GetService("TweenService")
local open = false
Part.Touched:Connect(function()
if open then
--Open Tween--
local tweeninfo = TweenInfo.new()
TweenService:Create(gui, tweeninfo, {})
else
--Close Tween--
local tweeninfo = TweenInfo.new()
TweenService:Create(gui, tweeninfo, {})
end
end)

I’m sorry if I ask these questions but I’m not that expert in scripting but does this make touching this part Tween the GUI?

Yes! You just have to fill in the missing variables since what I sent was an example.