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

Anybody know why this Fading Gui Script isn't working?

Asked by 5 years ago
Edited 5 years ago

Any help?

script.Parent.BackgroundTansparency = 1
wait(0.1)
script.Parent.BackgroundTansparency = 0.9
wait(0.1)
script.Parent.BackgroundTansparency = 0.8
wait(0.1)
script.Parent.BackgroundTansparency = 0.7
wait(0.1)
script.Parent.BackgroundTansparency = 0.6
wait(0.1)
script.Parent.BackgroundTansparency = 0.5
wait(0.1)
script.Parent.BackgroundTansparency = 0.4
wait(0.1)
script.Parent.BackgroundTansparency = 0.3
wait(0.1)
script.Parent.BackgroundTansparency = 0.2
wait(0.1)
script.Parent.BackgroundTansparency = 0.1
wait(0.1)
script.Parent.BackgroundTansparency = 0
wait(0.1)
0
Is it a localscript? Is it disabled? What kind of gui is it, for a ScreenGui, or a SurfaceGui? User#24403 69 — 5y
0
also use a for loop theking48989987 2147 — 5y
0
Yeah, really User#24403 69 — 5y
0
Tansparency.... greatneil80 2647 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

There's a typo and please Use a for loop

for i=1,0,-0.1 do
    script.Parent.BackgroundTransparency = i
end
Ad
Log in to vote
0
Answered by
yHasteeD 1819 Moderation Voter
5 years ago
Edited 5 years ago

Its simple, you can use a for loop(generic loop) and a wait(0.1)

Wait is for loop?

The for loop is a way of running a command or set of commands a set number of times. The basic syntax is as following:

How to use for loop?

for iterator_variable = start value , end value , increment do

(this is in wiki)

examples:

-- 1
for i = 1, 5 do     
    print("Hello Mom!") -- Print Hello Mom 5 times
end

-- 2
for i = 10, 1, -1 do    
    print(i) -- print number with start value 10 to 1: removing 1
end

-- 3
for i = 1, 10, 0.5 do       
    print(i) -- print number with start value 1 to 10: removing 0.5
end

Here is fixed script:

for i=1,0,-0.1 do -- value with 1 to 0: removing 0.1 until value not 0
    script.Parent.BackgroundTransparency = i -- set the transparency
    wait(0.1) -- Simple wait to have a delay when changing the transparency
end

Wiki pages:

For loop

Wait

Hope it helped :D

0
you can also use tweenservice for a much more cleaner effect and not as limited as using a numeric for User#23365 30 — 5y

Answer this question