Blur not changing size

repeat wait() until game:IsLoaded()

local srtv = 15
local endv = 6
local blur = script.Parent.Blur

function actBlur()
	for i = srtv,endv,-1 do
		wait(.5)
		blur.Size = i
	end
end

actBlur()

This is supposed to make it so when the game loads for the local player, the blur I’ve created shall go from 15 to 6 and go down by 1 every .5 seconds, it does not work for some reason, answers?

1 Like

make some debug prints to make sure the repeat wait() actually passes, and that all your functions are running ideally. also i would do something like this instead
local However_Many_Times_You_Want = 20;
local Wait_Time = .5;

for x = 1,20 do wait(Wait_Time)
--code...
end

also i recommend using ‘TweenService’ for something like this instead of a for loop to make it more aesthetically pleasing

Uh, how would I arrange the script? I did it like this with what you gave me

local srtv = 15
local endv = 6
local blur = script.Parent.Blur

for x = srtv,endv do wait(Wait_Time)

blur.Size = x

end

the first interval in the for loop is how much the loop is going up by. the second is the end goal. since your first number is 15, and the second 6, there is nothing to count to, as 15 >= 6.

what i mean is the first number is the interval in which goes up. for instance, if you had

for x = 2,4 do

it’d only run 2 times because 2 goes into 4 2 times

It’s supposed to be going down, I thought that was implied.

no, thats ok though, we all make mistakes! thats why we’re all here, to learn :slightly_smiling_face:

and i think the 3rd value in the for loop is the number in which ur increment starts at, i believe. correct me if im wrong anyone

It’s right here. But yeah, we all make mistakes.

It goes for count = start,end,inc do.

1 Like

image

shoot, you’re right, i had it mixed up: what i said ab the 3rd value should be 1, vise versa

Yeah, and that’s exactly what I just said, you said that it was start, increment, end, I said it was start, end, increment. But that’s not the point.

right, so originally you should add debug prints to make sure everything is working accordingly, especially within the loop as well. heres how id go about this however

im on my phone atm so sorry for all the errors lol! kind of hard to type this all

--local script

local Player = game.Players.LocalPlayer;
local Character = Player.Character or Player.CharacterAdded:Wait();
local Blur = Instance.new(“BlurEffect”, game.Lighting);

local Debris = game:GetService(“Debris”)
local TweenService = game:GetService(“TweenService”);
local Length = 3; -- 3 seconds
local Tweening_Info = TweenInfo.new(Length, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut);

local Goal = {
    Size = 0;
};

repeat wait() until Character;

local Tween = TweenService:Create(Blur, Tweening_Info, Goal);
Tween:Play();

Debris:AddItem(Blur, Length);

correct me if im wrong on anything, phone is tough to type on :sweat_smile:

also, mb for not specifying why i didnt include the third increment, it usually defaults to 1, i forgot to mention that for the for loop.

1 Like