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

My brain does not think efficiently, how can I combat?

Asked by 5 years ago
Edited 5 years ago

IF YOU LIKE "MIND BOGGLING", CONFUSING PROBLEMS, BE MY GUEST AND ANSWER

My background info: I have a GUI that shows 16 possible options to the player to choose from. They can only choose 2 options and they each have to be labelled Team 1 and Team 2. When the player selects the two, they each change color to the color selected and chosen label (They can choose which option is Team 1 and Team 2).

My problem: When the options change color, if they select two other options, I have to make sure that all 15 other options are back to their original colors and format.

Please tell me I don't have to make 16 variables and label the other 15 and make sure they all go back to normal.

ALSO Another problem is, if the player chooses Team1 and Team2, but doesn't like one of their choices and chooses a different option, 1.) You have to work around the TEAM1 variable and make sure the OLD TEAM2 is changed back and then change the NEW TEAM2 to the different color and format

So do I really have to label all of the variables?

I'm very confused, and props to the person who even wants to try at this <3<3

Heres what I got:

local debounce = true
local TeamValue = game.ReplicatedStorage:FindFirstChild("Values"):FindFirstChild("CustomTeamValue")
local CustomTeam1 = game.ReplicatedStorage:FindFirstChild("Values"):FindFirstChild("CustomTeam1")
local CustomTeam2 = game.ReplicatedStorage:FindFirstChild("Values"):FindFirstChild("CustomTeam2")

--SO here is where all of these options are
local AA1 = script.Parent.Parent.A1
local AA2 = script.Parent
local AA3 = script.Parent.Parent.A3
local AA4 = script.Parent.Parent.A4
local AA5 = script.Parent.Parent.A5
local AA6 = script.Parent.Parent.A6
local AA7 = script.Parent.Parent.A7
local AA8 = script.Parent.Parent.A8
local AA9 = script.Parent.Parent.A9
local AB1 = script.Parent.Parent.B1
local AB2 = script.Parent.Parent.B2
local AB3 = script.Parent.Parent.B3
local AB4 = script.Parent.Parent.B4
local AB5 = script.Parent.Parent.B5
local AB6 = script.Parent.Parent.B6
local AB7 = script.Parent.Parent.B7

script.Parent.MouseButton1Click:Connect(function()
    if TeamValue.Value == 1 then
        if not debounce then
            return
        end
        debounce = false
        script.Parent.BorderColor3 = Color3.fromRGB(255, 255, 0)
        if CustomTeam2 == "Dolphins" then
            CustomTeam1.Value = "Dolphins"
            CustomTeam2.Value = " "
        else
            CustomTeam1.Value = "Dolphins"
        end

        --[[ChangeBoarders--
        --AA1.BorderColor3 = Color3.fromRGB(0,0,0)
        AA2.BorderColor3 = Color3.fromRGB(0,0,0)
        AA3.BorderColor3 = Color3.fromRGB(0,0,0)
        AA4.BorderColor3 = Color3.fromRGB(0,0,0)
        AA5.BorderColor3 = Color3.fromRGB(0,0,0)
        AA6.BorderColor3 = Color3.fromRGB(0,0,0)
        AA7.BorderColor3 = Color3.fromRGB(0,0,0)
        AA8.BorderColor3 = Color3.fromRGB(0,0,0)
        AA9.BorderColor3 = Color3.fromRGB(0,0,0)
        AB1.BorderColor3 = Color3.fromRGB(0,0,0)
        AB2.BorderColor3 = Color3.fromRGB(0,0,0)
        AB3.BorderColor3 = Color3.fromRGB(0,0,0)
        AB4.BorderColor3 = Color3.fromRGB(0,0,0)
        AB5.BorderColor3 = Color3.fromRGB(0,0,0)
        AB6.BorderColor3 = Color3.fromRGB(0,0,0)
        AB7.BorderColor3 = Color3.fromRGB(0,0,0)
        AA2.BorderColor3 = Color3.fromRGB(0,0,0)
        --ChangeBoarders--]]

        wait(0.1)
        debounce = true

    elseif TeamValue.Value == 2 then
        if not debounce then
            return
        end
        debounce = false
        script.Parent.BorderColor3 = Color3.fromRGB(0, 170, 255)
        if CustomTeam1 == "Dolphins" then
            CustomTeam1.Value = " "
            CustomTeam2.Value = "Dolphins"
        else
            CustomTeam2.Value = "Dolphins"
        end

        --[[ChangeBoarders--
        --AA1.BorderColor3 = Color3.fromRGB(0,0,0)
        AA2.BorderColor3 = Color3.fromRGB(0,0,0)
        AA3.BorderColor3 = Color3.fromRGB(0,0,0)
        AA4.BorderColor3 = Color3.fromRGB(0,0,0)
        AA5.BorderColor3 = Color3.fromRGB(0,0,0)
        AA6.BorderColor3 = Color3.fromRGB(0,0,0)
        AA7.BorderColor3 = Color3.fromRGB(0,0,0)
        AA8.BorderColor3 = Color3.fromRGB(0,0,0)
        AA9.BorderColor3 = Color3.fromRGB(0,0,0)
        AB1.BorderColor3 = Color3.fromRGB(0,0,0)
        AB2.BorderColor3 = Color3.fromRGB(0,0,0)
        AB3.BorderColor3 = Color3.fromRGB(0,0,0)
        AB4.BorderColor3 = Color3.fromRGB(0,0,0)
        AB5.BorderColor3 = Color3.fromRGB(0,0,0)
        AB6.BorderColor3 = Color3.fromRGB(0,0,0)
        AB7.BorderColor3 = Color3.fromRGB(0,0,0)
        AA2.BorderColor3 = Color3.fromRGB(0,0,0)
        --ChangeBoarders--]]

        wait(0.1)
        debounce = true
    end
end)
0
This is a football gui btw for anyone who is wondering MusicalDisplay 173 — 5y
0
You could try a for loop that saves the color before changing them to there old color, or you could have a frame that is the selected color and when they arent selected make the selected frame go invisible so it just shows the real color. GottaHaveAFunTime 218 — 5y
0
ummm TheluaBanana 946 — 5y
0
id play much football, so whaaaaaa TheluaBanana 946 — 5y
View all comments (2 more)
0
first and foremost, try some for loops theking48989987 2147 — 5y
0
already did MusicalDisplay 173 — 5y

Answer this question