01 | local text = script.Parent:WaitForChild( "NotAdmin" ) |
02 |
03 | local tr = text.TextTransparency |
04 |
05 | local function w() |
06 | wait( 0.05 ) |
07 | end |
08 |
09 |
10 | print ( "Enabled text" ) |
11 | tr = 0.9 |
12 | w() |
13 | tr = 0.8 |
14 | w() |
15 | tr = 0.7 |
It prints as expected but does not actually change the "TextTransparency". Please help ;)
First of all, this code is just too long, we can make this so much shorter using TweenService or a for loop.
For this to work, just insert a LocalScript into the TextLabel.
Tweening
01 | local TweenService = game:GetService( "TweenService" ) -- retrieving TweenService |
02 | local tweenInfo = TweenInfo.new( |
03 | 5 , -- The period of time it takes to tween |
04 | Enum.EasingStyle.Linear, -- This is an easing style |
05 | Enum.EasingDirection.Out, -- This is an easing direction |
06 | - 1 , -- This is the number of times the tween will run. Setting this to -1 means it will run indefinitely |
07 | true , -- This means whether it will reverse the tween |
08 | 0 ) -- This is a delay before the tween starts in seconds |
09 | local properties = { TextTransparency = 1 } -- [[The property we're trying to change. Also, make sure to get the spelling of the property correct cause it will result in an error]] |
10 |
11 | local TextLabel = script.Parent -- This is just the reference for our TextLabel |
12 |
13 | TweenService:Create(TextLabel, tweenInfo, properties):Play() --[[ This creates our tween and instantly plays if you don't want the tween to instantly start playing just create a variable for it and play it]] |
For loop
01 | local TextLabel = script.Parent -- Referencing the Text label |
02 |
03 | for count 1 = 0 , 1 , 0.1 do |
04 |
05 | TextLabel.TextTransparency = count 1 |
06 | wait( 0.05 ) -- the wait between each iteration |
07 | end |
08 |
09 | for count 2 = 1 , 0 , - 0.1 do |
10 |
11 | TextLabel.TextTransparency = count 2 |
12 | wait( 0.05 ) -- the wait between each iteration |
13 | end |
14 |
15 | --[[ |
Any questions? Just reply to my answer.