----------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Events
----------------------------------------------------------------------------------------------------------------------------------------------------------------

camera.Changed:connect(function()
	local dis = (game.Lighting:GetSunDirection()-camera.CoordinateFrame.lookVector).magnitude
	local parts = camera:GetPartsObscuringTarget({camera.CoordinateFrame,game.Lighting:GetSunDirection()*10000},{((camera.CoordinateFrame.p-player.Character.Head.Position).magnitude < 1 and player.Character or nil)})
	if dis > 1 then dis = 1 end
	
	for i = 1,#parts do
		if parts[i] then
			dis = 1
			break
		end
	end
	
	ts:Create(blind,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0),{
		Brightness = (1-dis)*0.35
	}):Play()
	
	ts:Create(blur,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0),{
		Size = 15*(1-dis)
	}):Play()
end)
