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

Why doesn't this Gui script work, is something wrong with these 'if' statements?

Asked by 9 years ago

So, this script first needs to wait until 'results' is visible, then open a GUI. Then, it should check the text of two textlabels. If they are 'Action & Adventure" and "Easy" then it needs two open one of two GUIs. If the text is different, it needs to print something. It works up to where it needs to open that GUI, then stops. It doesn't print anything, no other GUI appears. Can you please help?

-- Here is my LocalScript
wait(1)
player = game.Players.LocalPlayer
gui = player.PlayerGui.ScreenGui
results = gui.results
stepone = results.step1choice
steptwo = results.step2choice
TMM = results.TMM.Visible
LD = results.TMM.Visible

results.Changed:connect(function()
    local value = results.Visible
    wait(1)
    results.Loading.Visible = true
    if stepone.Text== "Action & Adventure" then
        if steptwo.Text== "Easy" then
            local num = math.random(1,2)
            if num== 1 then 
                TMM = true

            else
                LD = true

            end
        else
            print("It isn't action and adventure!")
        end
    else
        print("it isn't easy!")
    end
end)

0
Can you upload the output? EzraNehemiah_TF2 3552 — 9y
0
It doesn't say anything. Neither does the Script Analysis. Antharaziia 75 — 9y

1 answer

Log in to vote
2
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

Changing TMM and LD just changes the value of the variable.

When you assigned it earlier, all you did was say

TMM = false
LD = false

It doesn't care how it got that false.


Instead, say

TMM = result.TMM

-------- etc


            TMM.Visible = true

It also looks like you have a typo in defining LD, since it's the same as TMM.

0
Thank you! Antharaziia 75 — 9y
Ad

Answer this question