Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Team Change Button, Clicked Twice SetCoreGUI Enabled?

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!

3 comments

0

Localscript / script?

0

local script

0

hmmm

1 answer

✓ Accepted answer

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

1 comment

0

I am also doing a weapon shop, what would I use to replace the TeamChanged?

This discussion is preserved as it was. New answers, comments, and votes are closed.