How would I make a blur happen while a shop is open?

Oh… wait I know why

You forgot to call the wrap thing!

1 Like
---{0.331, 0},{0.252, 0}
local ShopButton = script.Parent
local ShopFrame = script.Parent.Parent.Parent.Parent.MainShop

ShopFrame.Visible = false

ShopButton.MouseButton1Click:Connect(function()
	if ShopFrame.Visible == false then
		ShopFrame:TweenPosition(UDim2.new(0.331, 0, 0.252, 0), "Out", "Linear", .5, true)
		ShopFrame.Visible = true
		ShopButton.Text = "Close"
		coroutine.wrap(function()
			for i = 1, 35 do
				game.Lighting.UIBlur.Size += 1			
				wait(0.01)
			end
		end)()


	else
		ShopFrame:TweenPosition(UDim2.new(1, 0, 0.252, 0), "Out", "Linear", .5, true)
		wait(.5)
		ShopFrame.Visible = false
		ShopButton.Text = "Shop"
		coroutine.wrap(function()
			for i = 1, 35 do
				game.Lighting.UIBlur.Size -= 1			
				wait(0.01)
			end
		end)()
	end
end)

Try This

Is it working?

2 Likes

Why not use TweenService instead of a for loop? Also the coroutine is pointless since it’s event based.

The TweenService is annoying to me, as whenver I use

  • a for loop
  • a true loop
  • a wait loop
  • making things transparent over time

like, i use it for stuff like this , but really nothing else.

It’s much easier though:

local Lighting = game:GetService('Lighting')
local TweenService = game:GetService('TweenService')

local Blur = Lighting:WaitForChild('UIBlur')

TweenService:Create(Blur, TweenInfo.new(0.5), {
	Size = 35
}):Play()

I find loops more simple for increasing variables.

I only use tweening for Vector3 and UDim2 stuff.