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

Why doesn't this text change transparency?

Asked by 6 years ago
Edited 6 years ago

Why doesn't this script make the text shift transparency back and forth?

--Where the script is:
--Starter Gui
    --Gui (Where I access the 'Enabled' property)
        --textLabel (Where I change Transparency)
            --LocalScript (this script)

local textLabel = script.Parent --The text box that this script is in.
local transparency = textLabel.TextTransparency --accessing the TextTransparency property
local Enabled = textLabel.Parent.Enabled --accessing the 'Enabled' property of the GUI this text box is in

local waitTime = 0.05 --Wait per forloop increment
local perChange = 50 --Number of times incrementing

while Enabled do --If the GUI is enabled
    for i = 1, perChange do --Increment Transparency up
        transparency = 0.5 + i/perChange/2
        wait(waitTime)
    end
    for i = 1, perChange do --Increment Transparency down
        transparency = 1 - i/perChange/2
        wait(waitTime)
    end
end

Answer this question