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

[Solved] How can I make a blur effect whenever I open/close a GUI?

Asked by
fr2013 88
5 years ago
Edited 5 years ago

So how do I make the blur of 10 slowly happen when a player touches a brick while the GUI comes down but when they leave, the shop goes up and the blur effect goes to 0 slowly in the background.

I kept testing but it doesn't seem to work for me.

local blur = Instance.new("BlurEffect",game.Workspace.CurrentCamera)
blur.Name = "BlurTwo"
blur.Size = 0
local Delay = 1 -- Time it takes to scroll down / up

function onTouch(hit)

    if game.Players:FindFirstChild(hit.Parent.Name) then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if not player.PlayerGui:FindFirstChild("Shop") then
            local gui = script.Shop:Clone()
            gui.Parent = player.PlayerGui

            gui.Frame:TweenPosition(UDim2.new(.25,0,.25,0),"Out","Quint",Delay,true)
                for i = 0,10,1 do
                    wait()
                    blur.Size = i
                end
            repeat wait() until (player.Character.HumanoidRootPart.Position - script.Parent.Position).magnitude > 5

            gui.Frame:TweenPosition(UDim2.new(.25,0,-1,0),"Out","Quint",Delay,true)
            for i = 10,0,-1 do
                wait()
                blur.Size = i
            end
            wait(Delay)
            gui:Remove()
        end
    end

end

script.Parent.Touched:Connect(onTouch)
0
it goes in lighting Warfaresh0t 414 — 5y
0
So do I use the lighting to create the blur effect? fr2013 88 — 5y
0
also, don't use the parent parameter of instance.new theking48989987 2147 — 5y
0
I guess I'll create a BlurEffect in lighting and see if it works fr2013 88 — 5y
View all comments (4 more)
0
If this is a server script then you are going to need to add a remote event to locally make the blur effect or it will show up for everyone Warfaresh0t 414 — 5y
0
Nah this is for a Shop and it happens if I touch a part and the shop comes down while creating a blur int he background fr2013 88 — 5y
0
If I were you I would just clone the gui into the playergui after they touch then fire a remoteevent so the client can handle all of this Warfaresh0t 414 — 5y
0
Nvm I solved it just by creating a Blur Effect in lighting. But thanks for your ideas. fr2013 88 — 5y

1 answer

Log in to vote
0
Answered by
XDvvvDX 186
4 years ago

I think I got it. I don't think that using the TweenService on blur is correct, although it may seem to be, you should use the normal way, of fading by changing size. As I tested in my own game something equal, just change it's transpraency. You can also set this variable :

local blurFade = for i = 1, 10, -1
X.X.X.Blur.Size = Result

That's how you can use it, and I just checked it 1 min ago, and it works perfectly. I recommend you to try a few ways before randomly asking questions here. And good luck at programming.

Ad

Answer this question