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

How can you script BackgroundTransparency Cleanly?

Asked by 3 years ago

I've been a bit stuck on how to cleanly script BackgroundTransparency without doing this.

script.Parent.Frame.BackgroundTransparency = 0.1
wait(0.05)
script.Parent.Frame.BackgroundTransparency = 0.2
 -- And on and on, its stressful and unclean.

How can you script it to where it makes it cleanly play through the Transparency Frames?

Thank you for you're time.

2 answers

Log in to vote
1
Answered by 3 years ago

You can use tweens to smoothly animate properties and get the result you want.

local TweenService = game:GetService("TweenService")
local object = script.Parent.Frame

local TweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)

local goals = {
    BackgroundTransparency = 1
}

local tween = TweenService:Create(object, TweenInfo, goals)

tween:Play()
0
I'll try it CodedStars 70 — 3y
0
ye, that's a good one, but long GravityGouse99938 75 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

You can just use for loop, which will repeat script needed amount of time

Here's the code:

for i = 1,9 do
    wait(0.05)
    script.Parent.Frame.BackgroundTransparency = tonumber("0."..i) -- convert 9 to 0.9
end

And that's just it!

Answer this question