I am using a for loop to make a textlabel flash its transparency. it seems to break because it prints fno but then it repeats again for 30 loops.
01 | --here is the code to make the icon flash on peoples screens |
02 |
03 | if promptobject.Name = = "A" then |
04 | local A = objgui.Holder.PointA |
05 | local Awarner = objgui.Holder.PointAWarner |
06 |
07 | for L = 1 , 30 , 1 do |
08 | if cappingA = = true then |
09 | for i = 1 , 10 , 1 do |
10 | Awarner.BackgroundTransparency = Awarner.BackgroundTransparency - 0.05 |
11 | wait( 0.05 ) |
12 | print '1' |
13 | end |
14 |
15 | for i = 1 , 10 , 1 do |
When trying to fade the properties of an instance, it's recommended to use TweenService because it'll make your code look cleaner and shorter.
When making a Tween , you need a Constructor and a dictionary of the properties you're trying to tween.
01 | local instance = workspace.Part |
02 |
03 | local tweenInfo = TweenInfo.new( |
04 | 5 , -- Time it takes for the tween to finish |
05 | Enum.EasingStyle.Linear, -- EasingStyle |
06 | Enum.EasingDirection.In, -- EasingDirection |
07 | - 1 , -- This is the number of times it'll repeat. Setting this to a negative integer, it'll repeat the tween indefinitely |
08 | true , -- This is whether it'll repeat or not |
09 | 0 -- this is a delay between each tween before it starts |
10 | ) |
11 |
12 | local instanceProperties = { |
13 | Transparency = 1 |
14 | } |
15 |
Any questions? Just reply to my answer.