So I have a button that if pressed, then it opens up a team change frame, and gets rid of the core GUI's to make more room. What would I insert if I wanted it so if it was pressed again without one of the team change buttons pressed(In case they didn't want to switch teams and it was an accident)the core GUI's would be enabled again? here's the code:
script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.TeamChangeFrame.Visible = not script.Parent.Parent.TeamChangeFrame.Visible local StarterGui = game:GetService('StarterGui') StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) end)
thanks for your time!
Add a variable called TeamChanged that you set to true if the team changes.
local TeamChanged = false script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.TeamChangeFrame.Visible = not script.Parent.Parent.TeamChangeFrame.Visible if script.Parent.Parent.TeamChangeFrame.Visible == false and TeamChanged == false then --if frame closed and team hasn't changed then local StarterGui = game:GetService('StarterGui') StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true) else local StarterGui = game:GetService('StarterGui') StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) TeamChanged = false end end) --Then when the team changes: TeamChanged = true