I am trying to use a script for it to clear when you click play and blur again when you die. But it just goes negative and it wont go back up to 0
Script 1:
local player = game.Players.LocalPlayer local blur = game.Lighting:WaitForChild("Blur") while true do if player.Character.Humanoid.Health <= 0 then blur.Enabled = true repeat blur.Size = blur.Size + 0.1 wait(0.01) until blur.Size == 24 else end wait() end
Script 2:
local frame = script.Parent.Parent local blur = game.Lighting:WaitForChild("Blur") local player = game.Players.LocalPlayer while true do script.Parent.MouseButton1Click:Connect(function() frame:TweenPosition(UDim2.new(-1,0,-0.052,0), "In", "Sine", 1.5) wait(0.3) repeat blur.Size = blur.Size - 0.1 wait(0.01) until blur.Size == 0 blur.Enabled = false player.Character:MoveTo(Vector3.new(-202, 6.1, 44)) if blur.Size >= 0 then blur.Size = 0 end wait(5) end) end
Ask a question in the comments if I missed any details.
Hey Ki_ngPhantom,
<=
to operator to check for that. Below is the script assuming that everything else(like the tweening) works fine in your script. Also, I removed that useless if statement you had below the :MoveTo() method.local frame = script.Parent.Parent local blur = game.Lighting:WaitForChild("Blur") local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() frame:TweenPosition(UDim2.new(-1,0,-0.052,0), "In", "Sine", 1.5) wait(0.3) repeat blur.Size = blur.Size - 0.1 wait(0.01) until blur.Size <= 0 blur.Enabled = false player.Character:MoveTo(Vector3.new(-202, 6.1, 44)) wait(5) end)
local players = game:GetService("Players") local player = players.LocalPlayer; local lighting = game:GetService("Lighting"); local blur = lighting:WaitForChild("Blur"); player.CharacterAdded:Connect(function(char) local hum = char:WaitForChild("Humanoid"); hum.Died:Connect(function() blur.Enabled = true repeat blur.Size = blur.Size + 0.1 wait(0.01) until blur.Size == 24 end) end)
local players = game:GetService("Players") local player = players.LocalPlayer; local lighting = game:GetService("Lighting"); local blur = lighting:WaitForChild("Blur"); player.CharacterAdded:Connect(function(char) local hum = char:WaitForChild("Humanoid"); hum.Died:Connect(function() blur.Enabled = true; for i = 0, 24, 0.1 do wait(0.01); blur.Size = i; end end) end)
local frame = script.Parent.Parent; local lighting = game:GetService("Lighting") local blur = lighting:WaitForChild("Blur") local players = game:GetService("Players") local player = players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() frame:TweenPosition(UDim2.new(-1,0,-0.052,0), "In", "Sine", 1.5) wait(0.3) repeat blur.Size = blur.Size - 0.1 wait(0.01) until blur.Size <= 0 blur.Enabled = false player.Character:MoveTo(Vector3.new(-202, 6.1, 44)) wait(5) end)
local frame = script.Parent.Parent; local lighting = game:GetService("Lighting") local blur = lighting:WaitForChild("Blur") local players = game:GetService("Players") local player = players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function() frame:TweenPosition(UDim2.new(-1,0,-0.052,0), "In", "Sine", 1.5) wait(0.3)
for i = 24, 0, -0.1 do wait(0.01) blur.Size = i; end blur.Enabled = false player.Character:MoveTo(Vector3.new(-202, 6.1, 44)) wait(5)
end)
~~ KingLoneCat
Please note: I'm not a FE scripter
(SCRIPT #1) First off, you made it so ALL of the players see the blur effect, rather than the player itself. So when someone dies, everyone is going to have a blur effect, even the people who are still alive. To fix this, remove the blur effect in the Lighting, and change the second line to
Iocal blur = Instance.new('BlurEffect',workspace.CurrentCamera) blur.Enabled = false blur.Size = 0
Second, when the player respawns, they still see the blur effect. To fix this, you basically clear all of the children in the CurrentCamera. Put this in the first line:
workspace.CurrentCamera:ClearAllChildren()
Instead of waiting until the player dies with While True Do, you can basically use repeat instead. Example:
repeat wait() until player.Character.Humanoid.Health <= 0
Now, enable the blur effect! The 6th line on your script is very slow on making the blur effect huge, and doesn't have time to get it to 24, because it's very slow. It may hit like about 12 when you respawn, but it doesnt fully blur when you die. To fix this, instead of adding 0.1 to the size, add 0.5!
repeat blur.Size = blur.Size + 0.5 wait(0.01) until blur.Size >= 24
Full edited code:
workspace.CurrentCamera:ClearAllChildren() local player = game.Players.LocalPlayer local blur = Instance.new('BlurEffect',workspace.CurrentCamera) blur.Size = 0 blur.Enabled = false repeat wait() until player.Character.Humanoid.Health <= 0 blur.Enabled = true repeat blur.Size = blur.Size + 0.5 wait(0.01) until blur.Size >= 24
(SCRIPT 2) I don't get what you mean by "click play and blur again when you die", so please leave a comment here, and I will edit it until I figure out what you're talking about