Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

local question = script.Parent.Parent
local fr2 = script.Parent.Parent.Parent.Parent.Frame2
script.Parent.MouseButton1Click:connect(function()
	script.Parent.Parent.Parent.Visible = false
	wait(1)	
	local Response = math.random(5)
	wait(1)
	if Response == 1 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Yes."
	if Response == 2 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with No."
    if Response == 3 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Maybe."   
    if Response == 4 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Probably." 
    if Response == 5 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Probably not."   
	end  
	end
	end
	end
	end
	fr2.Visible = true
	wait(5)
	cd.MaxActivationDistance = 32
    fr2.Visible = false	
end)

No errors Local Script

1 answer

✓ Accepted answer
local question = script.Parent.Parent
local fr2 = script.Parent.Parent.Parent.Parent.Frame2
script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.Visible = false
    wait(1) 
    local Response = math.random(5)
    wait(1)
    if Response == 1 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Yes."
	end

    if Response == 2 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with No."
	end
    if Response == 3 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Maybe."   
	end
    if Response == 4 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Probably." 
	end
    if Response == 5 then
    fr2.X.Text = "You asked "..question.Text.." and it replied with Probably not."   
	end
    fr2.Visible = true
    wait(5)
    cd.MaxActivationDistance = 32
    fr2.Visible = false 
end)

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

This discussion is preserved as it was. New answers, comments, and votes are closed.