CanvasGroup it not working when I start click button and changed anything
-- Important Service
local Tweenservice = game:GetService("TweenService")
local StarterguiService = game:GetService("StarterGui")
local TeamGUI = game.StarterGui.Team.CanvasGroup
local Btn = script.Parent
TeamGUI.GroupTransparency = 1
TeamGUI.Size = UDim2.new(0,0,0,0)
local isOpen = false
local tweenInfo = TweenInfo.new( 0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut )
local OpenGoal = { Size = UDim2.new(1,0,1,0), GroupTransparency = 0 }
local CloseGoal = { Size = UDim2.new(0,0,0,0), GroupTransparency = 1 }
-- Tween open and close
local function TweenOpenClose()
if isOpen then
isOpen = false
local Close = Tweenservice:Create(TeamGUI, tweenInfo, CloseGoal)
Close:Play()
Close.Completed:Connect(function()
print("Close succ!")
end)
else
isOpen = true
local Open = Tweenservice:Create(TeamGUI, tweenInfo, OpenGoal)
Open:Play()
Open.Completed:Connect(function()
print("Open succ!")
end)
end
end
Btn.MouseButton1Click:Connect(TweenOpenClose)```