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

Gui Script help- why does the output say this?

Asked by 9 years ago

So, this script is supposed to check the text of two textlabels, and if they are 'easy' and 'action & adventure' Make one of two GUIs pop up. When I run it, the output says this

20:55:21.055 - Players.Player.PlayerGui.ScreenGui.results.LocalScript:13: bad argument #2 to '?' (string expected, got boolean)

results.LocalScript is the script I mentioned above. Here is the script...

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

results.Changed:connect(function()
    local value = results[RVisible]
    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
            script:Destroy()
        end
    else
        script:Destroy()
    end
end)

Thanks for the help!

0
Line 13 should be local value = results.Visible GoldenPhysics 474 — 9y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Well, you misused your variables. Change line 13 to

local value = RVisible
0
Thank you! I got that script from an alternate source, I didn't think it looked right... Antharaziia 75 — 9y
0
Hah, been there some that. No problem. Shawnyg 4330 — 9y
0
Hey, the script still doesn't work, can you see any other problems with it? I made sure that my two 'if' statements are true, I can't figure out why it doesn't work. Thanks! Antharaziia 75 — 9y
0
Not that I see. What does the output error? Shawnyg 4330 — 9y
Ad

Answer this question