Open here, I need help for a fading TextLabel that fades away the Stroke, Text, and background transparency all in one script without having a massive mess, with the open and or close function or feature.
✓ ANSWER ACCEPTED
Fading transparency without many lines?
1 answer
✓ Accepted answer
you use a for n=startNumber,goalNumber,incrementationNumber do
basically it's like this:
for i=0,1,0.1 do
print(i)
end
one thing to note is that if you are using a conditional operator between two objects then the last true object is gonna get returned so it's like this:
print(true and 3) --returns 3
print(true and "test") -- returns test
print(2 and 3) --returns 3
print(false and 2 or 3) -- returns 3 because false *and* 2 are false
now the script:
local Open = true -- change this if the whole thing is not visible by default
local TextLabel = script.Parent
function openClose()
local goal = Open and 1 or 0 -- if Open is true then the goal of transparency for all of those elements would be 1 (transparent) or else (not transparent)
local start = goal == 1 and 0 or 1
local inc = goal == 1 and 0.1 or -0.1 -- change 0.1 if you want it to be slower/faster
for i=start,goal,inc do
TextLabel.Transparency = i
TextLabel.TextTransparency = i -- you don't have to change the stroke because when text is transparent then the stroke is as well
wait(0.2) -- or this to be slower/faster
end
Open = not Open -- make it the opposite of what it was
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
