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

How can I make a smooth transparency transition?

Asked by
wet146 0
4 years ago
Edited 4 years ago

I know there's a simpler way to do this, but I don't know what to search to get an answer. Here's my script:

01local base = game.Workspace.Part
02while true do
03    base.Transparency = 0
04    wait(.1)
05    base.Transparency = 0.25
06    wait(.1)
07    base.Transparency = 0.5
08    wait(.1)
09    base.Transparency = 0.75
10    wait(.1)
11    base.Transparency = 1
12    wait(.1)
13    base.Transparency = 0.75
14    wait(.1)
15    base.Transparency = 0.5
16    wait(.1)
17    base.Transparency = 0.25
18    wait(.1)
19end

How can I make this shorter and give it a smoother transition?

3 answers

Log in to vote
1
Answered by 4 years ago

TweenService is the probably the best option as far as smoothness

Ad
Log in to vote
0
Answered by 4 years ago

well if you wanna make it shorter and smoother you can do:

01local base = game.Workspace.Part
02 
03repeat
04    base.Transparency = base.Transparency + 0.1
05    wait()
06until base.Transparency >= 1
07 
08wait(However long)
09 
10repeat
11    base.Transparency = base.Transparency - 0.1
12    wait()
13until base.Transparency <= 1
0
though this as sometimes failed for me so be careful, then again i just did till part.Transparency == 1 instead of >= 1 MrCatDoggo 213 — 4y
0
Think I got it working, thanks bro! wet146 0 — 4y
0
Np MrCatDoggo 213 — 4y
0
if you can. please do accept my answer, you do seem new to this MrCatDoggo 213 — 4y
View all comments (2 more)
0
Yeah how do I do that? and sorry i am new lol wet146 0 — 4y
0
it should be at the bottom of my answer, report and a few others MrCatDoggo 213 — 4y
Log in to vote
0
Answered by 4 years ago
1for i=0, 1, 0.25 do
2    base.Transparency = i
3    wait(.1)
4end

Answer this question