I want to make it so that when a player gets hurt, things further away will be blurry but everything nearby stays in focus, and then fades away after a few seconds. I am trying to achieve this with a local script located inside “StarterPlayerScripts.” It simply doesn’t work, but I would like to see if you could change the code to make it work.
This is what I have so far:
Script
--Variables
local plr = game.Players.LocalPlayer
local char = game.Workspace:WaitForChild(plr.Name)
local cam = workspace.CurrentCamera
char.Humanoid.Changed:Connect(function(Change)
if Change == "Health" then
local hurt = Instance.new("DepthOfFieldEffect")
local num = 0.75
hurt.Parent = cam
hurt.Name = "Suppression"
hurt.FarIntensity = 0.75
hurt.FocusDistance = 0.05
hurt.InFocusRadius = 15
local intensity = hurt.NearIntensity
intensity = num
for count = 1,15,1 do
num = num - 0.05
intensity = num
wait(0.01)
end
end
end)