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)

8 comments
it goes in lighting
So do I use the lighting to create the blur effect?
also, don't use the parent parameter of instance.new
I guess I'll create a BlurEffect in lighting and see if it works
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
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
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
Nvm I solved it just by creating a Blur Effect in lighting. But thanks for your ideas.