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

Why wont this text go transparent?

Asked by 9 years ago

I made this random script, and I didnt work as i wanted it to. Please help, and thanks!

local Sayings ={
"Hello, welcome back!",
"Have a good day!",
"Thanks for playing!",
"Make sure to give this game a like!",
"Dont forget to favorite this place!",
}


while true do
wait(2)
script.Parent.TextColor3 = Color3.new(math.random(),math.random(), math.random())
for transparency = 0, 1, .1 do

end
script.Parent.TextTransparency = transparency
wait(.1)
script.Parent.Text = (Sayings[math.random(1, #Sayings)])
for transparency = 0, -1, -.1 do

end
script.Parent.TextTransparency = transparency
wait(.1)
end

1 answer

Log in to vote
4
Answered by 9 years ago

You need to put the statements that set the transparency, which in this case they would be:

script.Parent.TextTransparency = transparency

inside of your for loop. If you don't do this, they won't be run each time the for loop iterates.

You should also put:

wait(.1);

inside of the for loops.

Here's your fixed code:

local Sayings ={
"Hello, welcome back!",
"Have a good day!",
"Thanks for playing!",
"Make sure to give this game a like!",
"Dont forget to favorite this place!",
}


while true do
wait(2)
script.Parent.TextColor3 = Color3.new(math.random(),math.random(), math.random())
for transparency = 0, 1, .1 do
script.Parent.TextTransparency = transparency
wait(.1)
end

script.Parent.Text = (Sayings[math.random(1, #Sayings)])
for transparency = 0, -1, -.1 do
script.Parent.TextTransparency = transparency
wait(.1)
end
end


Also, I don't know why you're wrapping: (Sayings[math.random(1, #Sayings)]) in parenthesis.

Sayings[math.random(1, #Sayings)] should work just fine.

Ad

Answer this question