so, for some reason, the blur effect isn’t destroying itself.
-- WHEN PLAYER LOADS --
function player_LOAD ()
local blur = Instance.new('BlurEffect', game.Lighting)
blur.Size = 100
local info = game.Players.LocalPlayer.PlayerGui.Main.Using.Button
local Main1 = game.Players.LocalPlayer.PlayerGui.Main
-- STATING WHAT HAPPENS WHEN YOU CLICK INFO --
info.MouseButton1Click:Connect(function()
wait(0.01)
blur:Destroy() -- DESTORYS WHICH DOESNT WORK
end)
end
player_LOAD() -- END LOADING --
I cleaned up your code a little, I made it compatible for that LocalScript you are showing in this picture. Tell me if anything goes wrong or if you get any errors:
function PlayerLoad()
local BlurEffect = Instance.new('BlurEffect', game:GetService("Lighting")); -- Creates the BlurEffect
BlurEffect.Size = 100; -- Gives the BlurEffect 100 of size
local Info = script.Parent;
local Main1 = game.Players.LocalPlayer.PlayerGui.Main;
local OnDis = script.Parent.Parent.Parent; -- ScreenGui
local OnClicked = script.Parent.Parent.Skip; -- Skip button
Info.MouseButton1Click:Connect(function()
game.Debris:AddItem(BlurEffect,.01); -- Destroys the blur effect after 0.01 seconds
wait(2); -- Waits 2 seconds before the skip button is visible
OnClicked.Visible = true; -- Makes the button visible
OnClicked.MouseButton1Click:Connect(function() -- If the player clicks then...
OnDis.Enabled = false -- The GUI becomes invisible
BlurEffect:Destroy() -- Destroy the blur effect
end);
end);
end;
PlayerLoad();
Sorry for the semicolons at the end of the lines, I’m just too used to use them when I write scripts lol.
local blur = Instance.new('BlurEffect')
blur.Size = 100
blur.Parent = game.Lighting
local gui = script.Parent
local skip = gui.Using.Skip
skip.MouseButton1Down:Connect(function()
blur:Destroy()
end)
Since you said it only is used once, there’s no need to put in a function, I also placed blur.Parent = game.Lighting and removed the 2nd paramter as it’s slower to do it like that, especially if you change a lot of properties. Also changed MouseButton1Click to MouseButton1Down since I heard the former can not work sometiems