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

Why won't it change the text on a textlabel?

Asked by
bossay6 62
7 years ago
Edited 7 years ago
01local question = script.Parent.Parent
02local fr2 = script.Parent.Parent.Parent.Parent.Frame2
03script.Parent.MouseButton1Click:connect(function()
04    script.Parent.Parent.Parent.Visible = false
05    wait(1)
06    local Response = math.random(5)
07    wait(1)
08    if Response == 1 then
09    fr2.X.Text = "You asked "..question.Text.." and it replied with Yes."
10    if Response == 2 then
11    fr2.X.Text = "You asked "..question.Text.." and it replied with No."
12    if Response == 3 then
13    fr2.X.Text = "You asked "..question.Text.." and it replied with Maybe."  
14    if Response == 4 then
15    fr2.X.Text = "You asked "..question.Text.." and it replied with Probably."
View all 27 lines...

No errors Local Script

1 answer

Log in to vote
0
Answered by
VoltCode 101
7 years ago
01local question = script.Parent.Parent
02local fr2 = script.Parent.Parent.Parent.Parent.Frame2
03script.Parent.MouseButton1Click:Connect(function()
04    script.Parent.Parent.Parent.Visible = false
05    wait(1)
06    local Response = math.random(5)
07    wait(1)
08    if Response == 1 then
09    fr2.X.Text = "You asked "..question.Text.." and it replied with Yes."
10    end
11 
12    if Response == 2 then
13    fr2.X.Text = "You asked "..question.Text.." and it replied with No."
14    end
15    if Response == 3 then
View all 28 lines...

You had every if condition within one another, so if response == 1 then if response == 2. That's how your's was.

Ad

Answer this question