I'm having some problems with my script. I'm new to scripting, so I don't know the answer to fix it.
I have two boxes; each is an answer to a question. I want it set up so when you click on it, the choices disappear and and the percentage, total agreed/disagreed, and the choices fade in in 1 second. While they are doing this, the percentage is going up by 1 at the right speed to take 1 second to get to the percentage that agreed with you.
My problems are 1) The percentage just goes to 0 instead of the percentage, and 2) The right box fades in after the left box is done; not at the same time. How can I fix these problems?
Sorry for the long code!
RFrame = script.Parent.RFrame
LFrame = script.Parent.LFrame
LValue = LFrame.TotalAgreed.Value.Value
RValue = RFrame.TotalAgreed.Value.Value
script.Parent.LFrame.Choice1.MouseButton1Down:connect(function(Choice1)
if RFrame.Choice2.Visible == true then
LFrame.Choice1.Visible = false
LFrame.TotalAgreed.Visible = true
LFrame.Choice.Visible = true
LFrame.Percent.Visible = true
LFrame.TotalAgreed.TextTransparency = 0
for i = 1,0,-.08 do
LFrame.Percent.TextTransparency = i
LFrame.Choice.TextTransparency = i
LFrame.TotalAgreed.TextTransparency = i
wait(.08)
end
for i = 0,(LValue/(LValue+RValue)),(1/(LValue/(LValue+RValue))) do
LFrame.Percent.Text = (i.."%")
wait(1/(LValue/(LValue+RValue)))
end
RFrame.Choice2.Visible = false
RFrame.TotalAgreed.Visible = true
RFrame.Choice.Visible = true
RFrame.Percent.Visible = true
RFrame.TotalAgreed.TextTransparency = 0
for i = 1,0,-.08 do
RFrame.Percent.TextTransparency = i
RFrame.Choice.TextTransparency = i
RFrame.TotalAgreed.TextTransparency = i
wait(.08)
end
for i = 0,(RValue/(RValue+LValue)),(1/(LValue/(LValue+RValue))) do
RFrame.Percent.Text = (i.."%")
wait(1/(RValue/(RValue+LValue)))
end
end
end)
script.Parent.RFrame.Choice2.MouseButton1Down:connect(function(Choice2)
if LFrame.Choice1.Visible == true then
RFrame.Choice2.Visible = false
RFrame.TotalAgreed.Visible = true
RFrame.Choice.Visible = true
RFrame.Percent.Visible = true
RFrame.TotalAgreed.TextTransparency = 0
for i = 1,0,-.08 do
RFrame.Percent.TextTransparency = i
RFrame.Choice.TextTransparency = i
RFrame.TotalAgreed.TextTransparency = i
wait(.08)
end
for i = 0,(RValue/(RValue+LValue)),(1/(LValue/(LValue+RValue))) do
RFrame.Percent.Text = (i.."%")
wait(1/(RValue/(RValue+LValue)))
end
LFrame.Choice1.Visible = false
LFrame.TotalAgreed.Visible = true
LFrame.Choice.Visible = true
LFrame.Percent.Visible = true
LFrame.TotalAgreed.TextTransparency = 0
for i = 1,0,-.08 do
LFrame.Percent.TextTransparency = i
LFrame.Choice.TextTransparency = i
LFrame.TotalAgreed.TextTransparency = i
wait(.08)
end
for i = 0,(LValue/(LValue+RValue)),(1/(LValue/(LValue+RValue))) do
LFrame.Percent.Text = (i.."%")
wait(1/(LValue/(LValue+RValue)))
end
end
end)
