✓ Accepted answer
Easy, instead of using :match() just check if Change == "Health". Another problem was that Character on line 2 had a Capital C and the other character on line 5 had a lower cased one. Also, the minimum value for FOV is 1, it cannot go over 120 or under 1.
local Player = game.Players.LocalPlayer
local Character = (function() repeat wait() until Player.Character return Player.Character end)()
local camera = game.Workspace.CurrentCamera
local FOV = 70
Character.Humanoid.Changed:connect(function(Change)
if Change == "Health" then
FOV = FOV -69
camera.FieldOfView = FOV
end
end)
If you want it so that if a player dies then use the Died event.
BTW I revised your whole script.
local Player = game.Players.LocalPlayer
local Character = (function() repeat wait() until Player.Character return Player.Character end)()
local camera = game.Workspace.CurrentCamera
Character.Humanoid.Changed:connect(function(Change)
if Change == "Health" then
camera.FieldOfView = 1
end
end)
Hope this helps!
1 comment
Did you thumbs down my comment? If so, since it works, atleast remove the thumbs down.