Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

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

Asked by 3 months ago
Edited 3 months 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 597 — 3mo

1 answer

Log in to vote
1
Answered by 3 months 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 — 3mo
0
<3 SpiralGaia 189 — 3mo
Ad

Answer this question