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 4 years ago
Edited 4 years ago

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

01local Blur = game.Lighting.Blur
02 
03script.Parent.MouseButton1Click:Connect(function()
04 
05Blur.Size = 1
06wait(.1)
07Blur.Size = 2
08wait(.1)
09Blur.Size = 3
10wait(.1)
11Blur.Size = 4
12wait(.1)
13Blur.Size = 5
14wait(.1)
15 
16--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 — 4y

1 answer

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

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

01local Blur = game.Lighting.Blur
02 
03function blur()
04Blur.Size = Blue.Size + 1
05end
06 
07script.Parent.MouseButton1Click:Connect(function()
08while Blur.Size < 10 then
09blur()
10end)

Untested, but should work.

~~SpiralRBX

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

Answer this question