I have an inventory GUI that has 2 modes, those two modes are as follows:
craft: The materials that can be used when crafting.
build: The buildables that you can place on your plot
Now the script that I have that controls the button to toggle between craft and build mode contains the following:
script.Parent.MouseButton1Click:connect(function()
local value = game.Players.LocalPlayer.PlayerGui.Inventory.mode.Value
if value == "craft" then
value = 'build'
script.Parent.Text = "build"
elseif value == "build" then
value = 'craft'
script.Parent.Text = "craft"
end
end)
With the default state of the inventory being build mode, when I hit the button, it changes to craft mode, however when it is clicked again it does not switch back to build mode. I assumed the problem was when it ran through the script, it saw the value as craft then switched it to build, then the next elseif statement saw it as build and switched it back to craft, resulting in no change. I decided that if this was the problem than a possible solution would be to break out of the if statement before it could continue to the elseif statement. I have a couple questions:
If breaking from the if statement would be a valid solution to this problem, how could I break out of it and If breaking from the if statement wouldn't be a proper solution, what would be?

5 comments
Why do you require the elseif statement? From how I'm looking at the script, it isn't necessary. :P
Can you include the full script with the part you declare the variable value.
Please supply the full script (Or at least the Click function)
Wait, does this fire again at all? Like, is it used in a function, loop, etc..?
I'm sorry for the lack of information, I updated it.