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

How would I make a smooth transition of a property with less lines of code?

Asked by 3 years ago
Edited 3 years ago

So I want to make a smooth transition with the Blur effect, and sure I could do something like this:

local Blur = game.Lighting.Blur

script.Parent.MouseButton1Click:Connect(function()

Blur.Size = 1
wait(.1)
Blur.Size = 2
wait(.1)
Blur.Size = 3
wait(.1)
Blur.Size = 4
wait(.1)
Blur.Size = 5
wait(.1)

--etc, etc..

But that can be a bit repetitive and messy, so I was wondering if anyone knows a way to make it do that, but with less lines of code. Thanks for the help in advance.

0
Do you want this to go on forever? Or do you want it to stop when something happens? Please specify Cynical_Innovation 595 — 3y

1 answer

Log in to vote
1
Answered by
SpiralRBX 224 Moderation Voter
3 years ago

Hi! This is a simple one. You can use a loop to do this.

local Blur = game.Lighting.Blur

function blur()
Blur.Size = Blue.Size + 1
end

script.Parent.MouseButton1Click:Connect(function()
while Blur.Size < 10 then
blur()
end)

Untested, but should work.

~~SpiralRBX

0
yay thanks, jut needed to add a wait, and change then to do. ShineBright2775 30 — 3y
0
<3 SpiralRBX 224 — 3y
Ad

Answer this question