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
3 years ago
Edited 3 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:

local base = game.Workspace.Part 
while true do 
    base.Transparency = 0
    wait(.1)
    base.Transparency = 0.25
    wait(.1)
    base.Transparency = 0.5
    wait(.1)
    base.Transparency = 0.75
    wait(.1)
    base.Transparency = 1
    wait(.1)
    base.Transparency = 0.75
    wait(.1)
    base.Transparency = 0.5
    wait(.1)
    base.Transparency = 0.25
    wait(.1)
end

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

3 answers

Log in to vote
1
Answered by 3 years ago

TweenService is the probably the best option as far as smoothness

Ad
Log in to vote
0
Answered by 3 years ago

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

local base = game.Workspace.Part 

repeat
    base.Transparency = base.Transparency + 0.1
    wait()
until base.Transparency >= 1

wait(However long)

repeat
    base.Transparency = base.Transparency - 0.1
    wait()
until 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 — 3y
0
Think I got it working, thanks bro! wet146 0 — 3y
0
Np MrCatDoggo 213 — 3y
0
if you can. please do accept my answer, you do seem new to this MrCatDoggo 213 — 3y
View all comments (2 more)
0
Yeah how do I do that? and sorry i am new lol wet146 0 — 3y
0
it should be at the bottom of my answer, report and a few others MrCatDoggo 213 — 3y
Log in to vote
0
Answered by 3 years ago
for i=0, 1, 0.25 do
    base.Transparency = i
    wait(.1)
end

Answer this question