Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Team Change Button, Clicked Twice SetCoreGUI Enabled?

Asked by 6 years ago

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!

0
Localscript / script? DanielDeJong3 158 — 6y
0
local script FlippinAwesomeCrew 62 — 6y
0
hmmm DanielDeJong3 158 — 6y

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

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
0
I am also doing a weapon shop, what would I use to replace the TeamChanged? FlippinAwesomeCrew 62 — 6y
Ad

Answer this question